To the chief Musician, A Psalm of David. This psalm was written by David, when he lay under the reproach and calumnies of men, who laid false things to his charge; things he was not conscious of either in the time of Saul's persecution of him, or when his son Absalom rebelled against him: and herein he appeals to the heart searching and rein trying God for his innocence; and, when settled on his throne, delivered it to the master of music, to make use of it on proper occasions.
According to the Syriac title of the psalm, the occasion of it was Shimei, the son of Gera, reproaching and cursing him as a bloody man, 2Sa 16:5. Theodoret takes it to be a prophecy of Josiah, and supposes that he is represented as speaking throughout the psalm.
Aben Ezra observes, that this is the most glorious and excellent psalm in all the book: a very excellent one it is: but whether the most excellent, it is hard to say. It treats of some of the most glorious of the divine perfections; omniscience, omnipresence, and omnipotence.
Arama says, the argument of it is God's particular knowledge of men, and his providence over their affairs.Ver. 1. O Lord, thou hast searched me, and known [me]. The omniscience of God reaches to all persons and things; but the psalmist only takes notice of it as respecting himself.
God knows all men in general, and whatever belongs to them; he knows his own people in a special manner; and he knows their particular persons, as David and others: and this knowledge of God is considered after the manner of men, as if it was the fruit of search, to denote the exquisiteness of it; as a judge searches out a cause, a physician the nature of a disease, a philosopher the reason of things; who many times, after all their inquiries, fail in their knowledge; but the Lord never does: his elect lie in the ruins of the fall, and among the men of the world; he searches them out and finds them; for be knows where they are, and the time of finding them, and can distinguish them in a crowd of men from others, and notwithstanding the sad case they are in, and separates them from them; and he searches into them, into their most inward part, and knows them infinitely better than their nearest relations, friends and acquaintance do; he knows that of them and in them, which none but they themselves know; their thoughts, and the sin that dwells in them: yea, he knows more of them and in them than they themselves, Jer 17:9.