I’ve read up to 2 Samuel 22. After putting down Absalom’s rebellion, David had to continue to consolidate his rule through more wars and rebellions. Joab turned out to be a ruthless and capable soldier and commander, David’s proverbial hatchet man. Chapter 22 is essentially a psalm of praise from David, who saw himself blameless before God (vv. 21-27). We know he wasn’t but in his old age he seemed to have forgotten the sins of his youth.
Some theologians may say David was foreseeing the remission from sin in Christ. The more cynical may say that David was full of himself and had selective memories. I’m somewhere in between. David was totally dependent on God, as is evident according to the rest of this psalm and other psalms. God was his Deliverer who rescued him from not just the sins of his enemies but also those of his own.
In any case, we are all sinners and we all need the Lord’s deliverance. We need to emulate David’s degree of dependency on God regardless of how far we sin. Most of us are not murders and many of us not adulterers like David but our need to depend on God is no different.