Posted by gateway69 on March 31, 2012 at 12:40am
I have this custom module that creates a db in drupal, the data doesn't change very often and I do some db_query calls to it for some of the things being done on the site.
I know their is some db caching happening but is this table worth saving to memory or disk, what would you guys do in this situation to lighting the load since this table would be called quite often to get some data from?
Comments
Query cache
If it's read-heavy, MySQL's query cache should do fine. Storage in RAM means dealing with making sure a disk copy stays in sync, or potentially losing data. Using the cache system, even if it's backed by memcache or something, might actually be slower.
But generally, this sounds premature. Don't worry about it until it becomes a problem and only make changes based on real-world measured performance.
you could eventually reduce
you could eventually reduce the amounts of db_query's
by using a singleton pattern in your module,
so that the class will only be instantiated once
per page load.
best regards