The prefix שֶׁ is very common in Mishnaic and Modern Hebrew, but in Tanakh appear rarely, except in Tehillim, Shir Hashirim, and Koheles, where it is all over the place. Why are these books the only ones where this prefix is common?
The relative pronoun -שֶׁ occurs in Deborah’s Song, in the story of Gideon, and in the Israelite sections of the Book of Kings. Consequently, the form -שֶׁ probably replaced אֲשֶׁר in Hebrew dialects of North Israel. The form became standard in Late Biblical Hebrew and Rabbinic Hebrew.
See Blau's Phonology and Morphology of Biblical Hebrew, pg. 183.