See here, 1. That it has been the lot of the best saints to be afflicted. The proud and the wicked lived in pomp and pleasure, while David, though he kept close to God and his duty, was still in affliction. Waters of a full cup are wrung out to God’s people, Ps. 73:10. 2. That it has been the advantage of God’s people to be afflicted. David could speak experimentally: It was good for me; many a good lesson he had learnt by his afflictions, and many a good duty he had been brought to which otherwise would have been unlearnt and undone. Therefore God visited him with affliction, that he might learn God’s statutes; and the intention was answered: the afflictions had contributed to the improvement of his knowledge and grace. He that chastened him taught him. The rod and reproof give wisdom.
This is a reason why David reckoned that when by his afflictions he learned God’s statutes, and the profit did so much counterbalance the loss, he was really a gainer by them; for God’s law, which he got acquaintance with by his affliction, was betterto him than all the gold and silver which he lost by his affliction. 1. David had but a little of the word of God in comparison with what we have, yet see how highly he valued it; how inexcusable then are we, who have both the Old and New Testament complete, and yet account them as a strange thing! Observe, Therefore he valued the law, because it is the law of God’s mouth, the revelation of his will, and ratified by his authority. 2. He had a great deal of gold and silver in comparison with what we have, yet see how little he valued it. His riches increased, and yet he did not set his heart upon them, but upon the word of God. That was better to him, yielded him better pleasures, and better maintenance, and a better inheritance, than all the treasures he was master of. Those that have read, and believe, David’s Psalms and Solomon’s Ecclesiastes, cannot but prefer the word of God far before the wealth of this world. -Matthew Henry