开发者

MySQL trigger in order to cache results?

开发者 https://www.devze.com 2023-02-11 23:50 出处:网络
I have a query that takes about a second to execute pre-cache. Post-cache is fine. Here\'s a description of the problem: MySQL: nested set is slow?

I have a query that takes about a second to execute pre-cache. Post-cache is fine. Here's a description of the problem: MySQL: nested set is slow?

If I can't get a solution for my problem, would creating a trigger to loop through and execute all the possible queries that table might have to do (i.e. if there are 100 records on that table, it would execute 100 queries) be a good idea? This way, when my application does execute such a query, I can depend on cached results.

It feels li开发者_JAVA百科ke a bad solution, but I really can't afford a 1 second response time from that query.


Since you are using a MyISAM table, you can try preload the table indexes into the key cache.

http://dev.mysql.com/doc/refman/5.0/en/cache-index.html

http://dev.mysql.com/doc/refman/5.0/en/load-index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号