In verses 7 and 8 the psalmist says,
The law of the Lord is perfect,
converting the soul;
the testimony of the Lord is sure,
making wise the simple.
The statutes of the Lord are right,
rejoicing the heart;
the commandment of the Lord is pure,
enlightening the eyes.
Now verse 11: Moreover by them is thy servant warned; and in keeping of them is great reward.
It is clear that by "the law," "the commandment," "the judgments," of the Lord, David means the ten commandments, which are abundantly proven to be the law of God (Ex. 31:18; 32:15, 16; Deut. 10:4), by which the servants of God are "warned," and in keeping of which is "great reward."
The "warning," the second commandment: "Visiting the iniquity of the fathers upon the children unto the third and fourth generation of them that hate Me."
Now the reward: "Showing mercy unto thousands of them that love Me, and keep My commandments."
A.T. Jones