With Hashem's help, I recently stumbled on a commentary on Tehilim written by Rav Chaim Kanievsky z’l. To understand Tehilim, it's important to know the background and historical context of the chapter that David Hamelech is writing about. What exactly was going on in his in life when he wrote it?
Sometimes he tells us exactly what’s going on in the heading, whether he’s running away, being chased, etc.
But sometimes he doesn't. And sometimes, it seems like he's telling us what's going on, but we really don't get it.
Rav Chaim Kanievsky, with his tremendous knowledge of Torah, finds a Midrash that helps us understand one such chapter. Chapter 30 is called Mizmor Shir, Hanukat HaBayit L’David/a song for the dedication of the House, referring to the Bet Hamikdash, by David.
There are two problems with this. Number one is that David Hamelech was not at the Hanukat HaBayit- he died before that. As we’ve discussed in the past, Rashi explains that he wrote it to be said at the Hanukat Habayit. The second problem is that there's no discussion of the Hanukat HaBayit in this Mizmor. It says,
אֲרוֹמִמְךָ֣ ה׳ כִּ֣י דִלִּיתָ֑נִי
God lifted me up…
שִׁוַּ֥עְתִּי אֵ֝לֶ֗יךָ וַתִּרְפָּאֵֽנִי
I called out to You and You healed me.
You lift me from the depths,
and so on.
What does that have to do with the Hanukat Habayit? Further into the perek, it says,
הֲיוֹדְךָ֥ עָפָ֑ר הֲיַגִּ֥יד אֲמִתֶּֽךָ׃
Will dirt praise You and say over Your truth?
לְמַ֤עַן ׀ יְזַמֶּרְךָ֣ כָ֭בוֹד וְלֹ֣א יִדֹּ֑ם יְהֹוָ֥ה אֱ֝לֹהַ֗י לְעוֹלָ֥ם אוֹדֶֽךָּ
So that my soul will sing to You forever..
So, again, what's going on? Rav Chaim cites a Midrash that David Hamelech was sick for 13 years, as he says in a different perek,
יָגַ֤עְתִּי ׀ בְּֽאַנְחָתִ֗י אַשְׂחֶ֣ה בְכׇל־לַ֭יְלָה מִטָּתִ֑י בְּ֝דִמְעָתִ֗י עַרְשִׂ֥י אַמְסֶֽה
Every night I'm crying in my bed.
So he suffered for 13 years, and during this time his enemies hoping he’d die. David Hamelech was obviously praying to get out of this situation. What got him out of it? He finally came up with the following prayer, “Please save me so that I'll have the strength to plan the Bet Hamikdash,” and that's when he got out of his bed and wrote what’s called the Megilat Binyan Bet Hamikdash/ the architectural plans for the Bet a HaMikdash, and God heard his prayer. David Hamelech got out of his bed and was totally healthy when he gave over and worked on that architecture. Rav Chaim Kanievsky adds that David Hamelech said this Mizmor when he handed over the scroll with the architectural plans. It was his Thank You for getting out of his sickness.
With that context, we are able to understand why it's called Mizmor Shir Hanukat HaBayit L’David. He wrote it for them to sing at the actual Hanukat Habayit, which he wasn't going to make it to. But he spoke about his sickness because what got him out was the fact that he wanted to do this.
Furthermore, a pasuk in this chapter says, זמרו לה׳ חסידיו /Sing to Hashem, the pious ones,
והודו לזכר קדשו
and thank Him.
First sing, then thank Him. Most time it's thank first and then sing, like it says,
ט֗וֹב לְהֹד֥וֹת לה׳ וּלְזַמֵּ֖ר לְשִׁמְךָ֣ עֶלְיֽוֹן׃
“It's good to thank You, and then you sing a song.” As it says, Shiru Lo, Zamru Lo/sing songs.
Normally, first you thank Hashem for what happened and then you sing the song. But here he says the pious ones, they sing the song even before it happens. David Hamelech was already singing the songs of his salvation, before it happened.
And he gives various reasons to get out of his sickness. “Can I thank you when I'm just dust? (which means, Can I thank You when I'm dead?)” Then he says, “Can I say over Your truth?” These reasons refers to the two things that a person is here in the world for: to thank Hashem and to state His Oneness.
David was using these as a reason to pull him out of his sickness. This is important. When someone is in trouble, a person can honestly and sincerely say, “Hashem, get me out of trouble because I still have a mission to complete. I still have something to accomplish. Get me out of this. I need to praise You. I need to fulfill my mission.”
This was David Hamelech’s secret of Mizmor Shir Hanukat Habayit L’David. Again, we can only understand this with Rav Chaim Kanievsky’s background and context (based on an unknown Midrash, which I searched for. It seems to be in an obscure Midrash, and not in the regular Midrashim).
Have a wonderful day.

