Reputation:
I have a MySQL database for an application, but with the increase of records response time has now gone up, so I thought of enabling mysql querycache in my database. The problem is we often restart the main machine so the query cache becomes 0 all the time. Is there a way to handle this problem?
Upvotes: 2
Views: 263
Reputation: 37354
I think you can try warming up cache in startup if you don't mind longer startup time... You can put queries in a separate file (or create a stored procedure that runs a bunch of selects
, and just call the SP), and then specify path to it in init_file
parameter of my.cnf
Upvotes: 1
Reputation: 12509
If your query times are increasing with the number of records, it's time to evaluate table indexes. I would suggest enabling the slow query log and running explain against the slow running queries to figure out where to put indexes. Also please stop randomly restarting your database and fix the root cause instead.
Upvotes: 2