0

In my live site currently we have 2.1M records in the search_query table. Due to this large number of records we are facing search slowness.

Whether it is advisable to truncate that table or remove the low priority search terms from that table?

  • What is the earliest search term? – Dominic Xigen Jul 10 at 16:19
  • less than 100 popularity 1.6M records are there – seeni Jul 11 at 10:18
  • What about earliest as in the oldest to be last updated? SELECT updated_at FROM search_query ORDER BY updated_at ASC – Dominic Xigen Jul 11 at 12:04
  • 2016-04-18 23:12:28 – seeni Jul 11 at 12:22
0

I recommend that you clear out old entries rather than clear out lesser used terms. Because that way you are not skewing your statistics. You still want more recent lesser used terms as it still gives you an insight into popular/non-popular search terms on your website.

DELETE FROM search_query WHERE updated_at < DATE_SUB(CURDATE(), INTERVAL 2 YEAR)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.