CodeIgniter Forums
codeignitors database query cache VS. MySQL query cache - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: codeignitors database query cache VS. MySQL query cache (/showthread.php?tid=3767)



codeignitors database query cache VS. MySQL query cache - El Forum - 10-21-2007

[eluser]dreamynsx[/eluser]
Hello!

Okay, so here I found CI's db caching mechanisim, which essentially caches queries/results into file system
http://ellislab.com/codeigniter/user-guide/database/caching.html

And here, is info on MySQL's query cache mechanism, which caches queries/results into memory
http://dev.mysql.com/doc/refman/5.0/en/query-cache.html


Big Broad Questions
Which one is better?
Are they the same functionally?
Which is better for performance in single server environment?
MySQL's query cache can't cache SELECTS with RAND() for example, can CI's DB query cache?

Any other thing good to know? Thanks!


codeignitors database query cache VS. MySQL query cache - El Forum - 10-21-2007

[eluser]kevinprince[/eluser]
Which one is better depends on what your doing.

File System caching will be faster but queries in RAM are faster. The difference is you can cheapely have 1gb of Hard Drive space on a shared host but 1gb ram isnt. On a low traffic site no real speed different.

CI cache like memcached requires you to delete the caches to display new results were as MYSQL manages the RAM cache and erases it if the table is erased.

It really depends on your server setup, and your application. A Twitter like application would make more sense to use RAM based caching because you want changes to appear in the site instantly but for a content site like BBC file based is fine.

Alternative to this would be to included a command to erase the cache when you update the table.

Hope this helps, if you let us know what your building might be able to advise you better.