Psalm 39's title says it is For the Chief Musician, For Jeduthun, and is A Psalm by David. It is a quiet, thoughtful prayer about how short life is. David first tells what he planned: I will watch my ways, so that I don't sin with my tongue. I will keep my mouth with a bridle while the wicked is before me. He kept silent, even from good, but his sorrow was stirred. My heart was hot within me. While I meditated, the fire burned. So he spoke to God.
His request is surprising. Yahweh, show me my end, what is the measure of my days. Let me know how frail I am. He continues, Behold, you have made my days hand widths. My lifetime is as nothing before you. Surely every man stands as a breath. People walk like shadows and busy themselves in vain. A man heaps up riches and doesn't know who shall gather them. In the New Testament, Jesus tells of a rich man who stored up goods and died that night, not knowing who would get them (Luke 12:16-21).
Then David finds his anchor: Now, Lord, what do I wait for? My hope is in you. He asks, Deliver me from all my transgressions. He admits that God's correction has worn him down. Finally he pleads, Hear my prayer, Yahweh, and give ear to my cry. Don't be silent at my tears. For I am a stranger with you, a foreigner, as all my fathers were. David sees himself as a traveler passing through, whose real hope is in God alone.