God has been good to His people. He has not treated us as our sins deserve. He has shown us much mercy and grace and lovingkindness. As the Puritans once said - "Anything this side of hell is pure grace." Christ has spared us from the one thing we truly deserve so everything else is icing on the cake - pure grace icing!
David knows this full well and he therefore begins this section of Psalm 119 with an acknowledgment of God's good dealings with him. "Thou hast dealt well with Thy servant, O LORD, according to Thy word." I can't help but think of the words of the sons of Korah that are found in Psalm 84 : "For the LORD God is a sun and shield; the LORD gives grace and glory; no good thing does He withhold from those who walk uprightly." God withholds NO good thing from His children and if He has directed something in your path - even if at the moment the "thing" seems hard and bad - please trust that He has brought it about to serve ultimately as a good thing for you.
God has planned all of our ways in perfect faithfulness (Isaiah 25:1) even the ways that seem crooked and bumpy and difficult to travel upon. God knows how to make the rough ways smooth and He will do so in His perfect timing for He is working all things together for the good of those who love Him and are the called according to His purposes (Romans 8:28).
Mr. Henry writes: "However God has dealt with us we must own that He has dealt with us better than we deserve, and He has dealt with us in love and with design to work for our good."
David, who has faced so much, trusts that God has dealt well with Him. He trusts that it is so because the Word declares it to be so - "Thou hast dealt well with Thy servant, O LORD, according to Thy Word." The Word of God is the standard by which David will determine what is true. He will not base his belief on his feelings or his circumstances but will let the Law and the Testimonies of His God to be the lens through which he views his life.
Recognizing what the Word declares and believing it to be true, David understandably pleads with God to teach Him to know this Word. "Teach me good discernment and knowledge, for I believe in Thy commandments."
God has dealt well with Him. He has given Him a new heart and an eternal hope. Knowing that God has granted these immeasurable and imperishable gifts He now pleads with His Father to grant Him a mind to understand and make good use of the commandments. This prayer of David parallels perfectly with James chapter 1. There, James the bond-servant of Christ marvelously echoes David's plea.
"Consider it all joy, my brethren, when you encounter various trials, knowing that the testing of your faith produces endurance. And let endurance have its perfect result, that you may be perfect and complete, lacking in nothing. But if any of you lacks wisdom, let him ask of God, who gives to all men generously and without reproach, and it will be given to him."
Whatever we encounter - even trials - have a good and perfect and sanctifying result. (Sounds like verse 65, "Thou hast dealt well with Thy servant." ) In whatever perfecting path God has placed us on we have need to pray for wisdom to make the right use of it. We need God to teach us good discernment and knowledge. We need Him to do so and He will do so for He loves to give generously and without reproach those things that are necessary.
Friends do you recognize just how wonderfully well He has dealt with you? Do you recognize that the Scriptures declare His all-wise and all-good sovereignty in whatever path you are traveling? Are you begging Him to help you increase in your discernment and knowledge and faith? It is a good prayer may we be diligent in uttering it.