Say I have a DB with 30,000 items in it. If users repeatedly search this DB, it can put quite a strain on my server. What I want is this: A user searches for something but the query only checks the 5,000 most recent results. Is that possible?
Yes, but sort of. The only way to get the most recent entries is to do an order by. Such as Select * from table order by date limit 5000 The problem is that will grab everything, order it, then return only 5000. You could set it up so that you have a "search" table so that every time something is inserted into the main table it's also inserted into the search one and the first entry is deleted. You could maybe setup a trigger or cron job, or have it part of the site code, but that will keep the strain down as you won't have to order 30,000 rows every time a search is run. 30,000 rows is not a lot. Do you have any indexes on the columns? If not, that's your problem.
What type of site is this? A lot of CMS'es have some sort of caching plugin or module that you can add in. Not all of them work with searches though. You may want to look into something like that. Or output the search as a static page if you're up to coding that. Have it expire after a few hours.