There was a family, close family friends, who moved to another state for a few years just after I graduated from high school. Then a few years later they moved back near us as it was only a temporary work for the father. The oldest son Danny told about an incident that happened during those years away. He was hiking or climbing near a water fall. Somehow he fell. He doesn't remember much from when he fell. He only knows when he was found he was on the only large rock around. There were many other rocks underwater at the bottom of the waterfall, in fact so many that it was a wonder that he hadn't fallen on any of them. There was just one small pool next to the rock he was on and all that could be determined was that he had fallen into the only pool amongst all the rocks and somehow got out of that pool onto the rock where they found him. Then Danny quoted the first verses of this psalm.
To him that excelleth. A Psalm of David
I waited patiently for the Lord, and he inclined unto me, and heard my cry. He brought me also out of the horrible pit, out of the miry clay, and set my feet upon the rock, and ordered my goings. And he hath put in my mouth a new song of praise unto our God: many shall see it and fear, and shall trust in the Lord.
Psalms 40:1 - 3 GNV
What a testimony by Danny of the Lord to the Lord describing what had happened in his life.
Beyond Danny's immediate testimony the psalm continues on with great truths and praise of who the Lord is.
O Lord my God, thou hast made thy wonderfull works so many, that none can count in order to thee thy thoughts toward us: I would declare, and speak of them, but they are more then I am able to express.
Psalms 40:5 GNV
And how who God is and what He has done works in the heart of men.
Then said I, Lo, I come: for in the roll of the book it is written of me, I desired to do thy good will, O my God: yea, thy Law is within mine heart. I have declared thy righteousness in the great Congregation: lo, I will not refrain my lips: O Lord, thou knowest. I have not hid thy righteousness within mine heart, but I have declared thy truth and thy salvation: I have not concealed thy mercy and thy truth from the great Congregation.
Psalms 40:7 - 10 GNV
As I considered this testimony both that of my friend and this psalm of David the question came, what is prayer? What is worship? Coincidentally, no, wait, with God there is no such thing as coincidence, but at the right time a separate Bible study I was reading just "happened" to be about worship, worship being the lifting up of God and the putting down of ego.
In that I asked if this was a psalm Jesus would pray knowing full well it wasn't. But as I considered other prayers made in the Bible God brought to mind Hezekiah. The enemy had sent a letter of demands against God's people and the land God had given them. As king Hezekiah knew there was a much larger army of the enemy ready to destroy them and that within the letter and within the speech the enemy envoy gave to the people telling how the gods of the other nations hadn't protected them, so why would they be deceived thinking the God of their king would be any different, after all gods are only gods against a mighty army like theirs, within all this the Lord God of Israel was being defamed to His face. The Scripture goes on to tell how Hezekiah brought that predeclaration of defeat before the Lord and the Lord caused the army that lay seige to have to be diverted back to the home lands and in one night the angel of the Lord destroyed one hundred eighty five thousand of that enemy army. Hezekiah only brought what was said in the letter before the Lord.
During the ministry Jesus had over and over again after healing so many Jesus told the lepers, the epileptics, the lame, and others not to tell what Jesus had done. Not many followed that order. There are times we read that Jesus could no longer go in the town, but had to remain in the country so many were seeking to be healed. What leper who was healed could not say like David, He lifted me up out of a horrible pit, out of the miry clay, and set my feet that are no longer rotting out from under me, yes, He set my feet on a solid rock. As I considered Jesus reaction to this psalm He too could like Hezekiah bring this psalm that David His forefather had written and read it to His Father telling what others were saying about Him. Where Hezekiah brought an evil letter Jesus could bring these words of praise and present them to His Father with joy and delight, not that Jesus was lifted up, but that His Father was lifted up in such a great way.