2 David also conquered the land of Moab. He made the people lie down on the ground in a row, and he measured them off in groups with a length of rope. He measured off two groups to be executed for every one group to be spared. The Moabites who were spared became David's subjects and paid him tribute money.
Matthew Henry's Commentary on 2 Samuel 8:2
Commentary on 2 Samuel 8:1-8.
(Read 2 Samuel 8:1-8.)
David subdued the Philistines. They had long been troublesome to Israel. And after the long and frequent struggles the saints have with the powers of darkness, like Israel with the Philistines, the Son of David shall tread them all under foot, and make the saints more than conquerors. He smote the Moabites, and made them tributaries to Israel. Two parts he destroyed, the third part he spared. The line that was to keep alive, though it was but one, is ordered to be a full line. Let the line of mercy be stretched to the utmost. He smote the Syrians. In all these wars David was protected, for this in his psalms he often gives glory to God.