Psalm 1, The Sankt Florian Psalter.
Many scholars say Psalm 40 is a Messianic Psalm, which is prophetic words about Jesus. In Hebrews 10, Paul attributes the Psalm to Christ. What I find interesting about these kind of Psalms is that they not only tell of Jesus’ coming suffering; they tell of Jesus’ feelings.
So, here are some commentaries on Psalm 40.
Barnes’ Notes on the Bible.
“Lo, I come,” – It is difficult to see how this could be applied to David; it is easy to see how it could be applied to the Messiah. When all bloody offerings under the law – all the sacrifices which men could make – did not avail to put away sin, it was true of the Messiah that he came into the world to perform a higher work that would meet the case – a lofty work of obedience, extending even unto death, Philippians 2:8. This is precisely the use which the apostle makes of the passage in Hebrews 10:7, passage in Hebrews 10:7, and this is clearly the most obvious meaning. It is in no sense applicable to David; it is fully applicable to the Messiah.
In the volume of the book – literally, “in the roll of the book.” See the notes at Luke 4:17. The phrase would most naturally denote the “scroll of the law;” but it might include any volume or roll where a record or prophecy was made. In a large sense it would embrace all that had been written at the command of God at the time when this was supposed to be spoken. That is, as spoken by the Messiah, it would include all the books of the Old Testament. See the notes at Hebrews 10:7.
Gill’s Exposition of the Bible.
“For innumerable evils have compassed me about – Have surrounded me, or have beset me on every side.” The evils here referred to, understood as being those which came upon the Messiah, were sorrows that came upon him in consequence of his undertaking to do what could not be done by sacrifices and offerings; that is, his undertaking to save men by his own “obedience unto death.” The time referred to here, I apprehend, is that when the full effects of his having assumed the sins of the world to make expiation for them came upon him; when he was about to endure the agonies of Gethsemane and Calvary.
Barnes’ Notes on the Bible:
“So that I am not able to look up.” – This is not the exact idea of the Hebrew word. That is simply, I am not able to see; and it refers to the dimness or failure of sight caused by distress, weakness, or old age. The idea here is, not that he was unable to look up, but that the calamities which came upon him were so heavy and severe as to make his sight dim, or to deprive him of vision. Either by weeping, or by the mere pressure of suffering, he was so affected as almost to be deprived of the power of seeing.
“…are more than the hairs of mine head,” – That is, the sorrows that come upon me in connection with sin. The idea is that they were innumerable – the hairs of the head, or the sands on the seashore; being employed in the Scriptures to denote what cannot be numbered.
“Therefore my heart faileth me,” – as in Hebrew: “forsaketh.” The idea is that he sank under these sufferings; he could not sustain them.
When I read the whole Psalm, I get a glimpse of what Jesus went through for us. A list of Messianic Psalms can be found: http://www.simplybible.com/f01p-psalms-about-christ.htm