This Psalm may have been written late in David’s exile, or early in his reign in Hebron.
David referred to the wicked (v3) and unrighteous(v2) people as lion (v) , serpent and cobra (v4). He was probably referring to officials of Saul, e.g. Doeg the Edomite. (1 Sam 22:9).
David knew that revenge is of God (Deut 32:35, Heb 10:30, Rom 12:19). David didn’t carry any revenge himself but he would prayed to God will judge the unrighteous (v6).
v10: [wash his feet in the blood]. Walking in cream and oil was a picture of wealth (Job 29:6). Walking in blood was a picture of great victory.
v11: God will vindicate Himself, the unrighteous will be punished, so that men will say “Surely there is a God who judges on earth!”