This Psalm, which Hossfeld and Zenger associate with other, pre-exilic ‘psalms of the poor’ (Psalm 4, 11-14) also seems to contain wisdom traditions, notably an implicit ‘two ways’ structure which comes through in the contrasting imagery in 52.5 and 52.8 (references are to the English).
The way of the evildoer (whose evil deeds are as much a matter of what is said as what is done) leads ultimately to a scene of destruction (the imagery of v5 is of war, followed by storm). That of the righteous derives from a trust in God, rather than riches (note the repeated use of בָּטַחְתִּי/ וַיִּבְטַח
in verses 7 and 8).
The overall context for the comparison is the enduring covenant-faithfulness of God: the חֶסֶד אֵל כָּל־הַיּוֹם of 52.3 should be kept as ‘God’s steadfast love endures all day’, rather than following the LXX and Peshitta as the NRSV does, thus forming an inclusio with בְחֶסֶד־אֱלֹהִים עוֹלָם וָעֶד in 52.10.
So, while there is some, to modern ears, rather unsavoury gloating at the fate of the unrighteous in vv6-7, the overall force of the Psalm is to make clear a basic choice over the orientation of life. Is our fundamental trust to be placed in our own heroic self-assertion and the accompanying riches that such a life almost inevitably brings, or recognising what such lives do to the poor, do we trust in the steadfast love of God and so associate with those who live out that love: the חֲסִידֶיךָ of 52.9? The Davidising preface only serves to distract us from the basic invitation made by this Psalm (and much of the rest of the wisdom tradition): where are your roots? who do you trust? with whom will you choose to associate and identify in life?