We don’t know the exact time of the writing. But we can say David is beyond childhood, he has enemies and is intimately aware of danger. So David writes this Psalm to express his confidence in the Lord’s care for him. David is asking God to do something for him, rather he is confessing his confidence. And as he reflects on God and what he does he draws two analogies, one of a shepherd and one of a host taking care of his guests.
Scripture: Psalm 23