David thanks God as he reminisces about his life
Psalm 23 is an allegory about the called out first fruits who are called to become kings in the Kingdom of God.
The called out first fruits of the New Covenant are to follow God and to live by every Word of God the Good Shepherd just like David did; and if they continue in doing so, they shall be filled with the spiritual meat of the Word and in the resurrection will receive eternal life and all good things.
Psalm 23:1 The LORD is my shepherd; I shall not want. 23:2 He maketh me to lie down in green pastures: he leadeth me beside the still waters.
God leads us to the green pastures of the spiritual food and water of the Word of God, which brings life eternal.
23:3 He restoreth my soul: he leadeth me in the paths of righteousness for his name’s sake.
God has promised that all who follow God and diligently live by every Word of the righteousness of God. will have their lives restored in the resurrection to eternal life from the dead.
23:4 Yea, though I walk through the valley of the shadow of death, I will fear no evil: for thou art with me; thy rod and thy staff they comfort me.
Even though we die physically, if we accept the rod of God’s wise instructional correction and lean on the sure staff of God’s Righteous Word we need not fear, for if we are faithful to live by every Word of God we have God’s unshakable promise that he will raise us up from the valley of death to eternal life as a spirit.
23:5 Thou preparest a table before me in the presence of mine enemies: thou anointest my head with oil; my cup runneth over.
God has promised that if we are faithful to live by every Word of God, he will anoint us with his Holy Spirit and raise up to eternal life and the anointing of kingship and priesthood in the sight of our enemies.
23:6 Surely goodness and mercy shall follow me all the days of my life: and I will dwell in the house of the LORD for ever.
We have God’s unbreakable promise that if we are faithful to live by every Word of God, enduring and overcoming all things through the power of God dwelling in us, God’s mercy and blessings will pour upon us like a river and we shall dwell for all eternity in the house [family] of God.
All things were created by God and belong to him
Psalm 24:1 The earth is the LORD’s, and the fulness thereof; the world, and they that dwell therein. 24:2 For he hath founded it upon the seas, and established it upon the floods.
The physical temple is an allegory of the heavenly temple. This question is an allegorical question, asking who shall be in the resurrection to spirit and ascend to stand before God.
Only the person who is clean from any and all sin, being cleansed from all past sin by sincere repentance, the application of the blood sacrifice of the Lamb of God and going forward to live by and be filled full with every Word of God; will be filled with the righteousness of the Word of God and lifted up from the grave to his eternal salvation.
24:4 He that hath clean hands, and a pure heart; who hath not lifted up his soul unto vanity, nor sworn deceitfully. 24:5 He shall receive the blessing from the LORD, and righteousness from the God of his salvation.
Only those who reject all sin and seek God with a whole heart to live by every Word of God, will be saved from death to eternal salvation.
24:6 This is the generation of them that seek him, that seek thy face, O Jacob. Selah.
If we open up the gates and doors of our hearts in sincere repentance and a wholehearted dedication to live by every Word of God, he shall enter and dwell within us through his Holy Spirit (Rev 3:19-22).
24:7 Lift up your heads, O ye gates; and be ye lift up, ye everlasting doors; and the King of glory shall come in. 24:8 Who is this King of glory? The LORD strong and mighty, the LORD mighty in battle.
If we are faithful to sincerely repent and turn away from all departure from the Word of God to live by every Word of God, the doors of our hearts will be opened eternally to the Holy Spirit of the King of Glory; and God shall dwell eternally within us through his Holy Spirit.
24:9 Lift up your heads, O ye gates; even lift them up, ye everlasting doors; and the King of glory shall come in. 24:10 Who is this King of glory? The LORD of hosts, he is the King of glory. Selah.