The last Mishna in מסכת ברכות speaks of the idea of a תפילת שוא, a prayer in vain. Two examples are given of such a prayer.
One is where someone learns that his wife is pregnant. He then begins praying that the baby should be a boy. The other example is where one enters his street on his way home, and he hears horrible screaming. He prays that those screams should not be from his home.
The Mishna is teaching us that we need to be in touch with reality. We cannot change what has already transpired. And it’s probably not a good idea to dwell on the past. We need to face the past in truth and accept and learn from what has happened in our lives.
Once this is done, we can move on and focus on the present and future. Praying for our success and asking for Hashem’s help in current and future endeavors, is a positive thing to do.
Our prayers will then be appropriate and not a תפילת שוא.