David, in this psalm, is full of complaints, yet those did neither jostle out his praises nor put him out of tune for them; whatever condition a child of God is in he does not want matter for praise and therefore should not want a heart. See here, 1. How often David praised God—Seven times a day, that is, very frequently, not only every day, but often every day. Many think that once a week will serve, or once or twice a day, but David would praise God seven times a day at least. Praising God is a duty which we should very much abound in. We must praise God at every meal, praise him upon all occasions, in every thing give thanks. We should praise God seven times a day, for the subject can never be exhausted and our affections should never be tired. See Ps. 119:62. 2. What he praised God for—because of thy righteous judgments. We must praise God for his precepts, which are all just and good, for his promises and threatenings and the performance of both in his providence. We are to praise God even for our afflictions, if through grace we get good by them.