1

What sort of MySQL query cache should I choose considering the following...

  • Large, rapidly growing database (I got 500,000 rows).
  • UPDATEs practically never happen.
  • SELECTs are rare, but when they do happen, they'll usually happen in huge batches.
  • Lots of small INSERTs.
  • A row is not usually SELECTed multiple times within a small period of time.
  • I want to reduce memory footprint (server is using lots of memory).

Would I be looking for a large cache, or small cache?

From what I understand a cache isn't hugely important as repeated SELECTs are very rare.

asked Apr 9, 2015 at 2:48
1
  • 1
    You should use the one that performs the best when you benchmark a realistic workload on it. That said, just turn the cache off. It adds overhead to every query while it goes through the code to check the cache. Commented Apr 9, 2015 at 3:08

1 Answer 1

1
query_cache_type = 0
query_cache_size = 0

Seriously, turning off the QC is probably best. especially based on what you said. Keep in mind that every INSERT (or UPDATE) to a table causes all entries in the QC to be purged. Furthermore, if the QC size is large, (say, over 50M), the purge time slows down the write.

The ENGINE's cache is important to both reads and writes. Generally MyISAM's key_buffer_size should be 20% of available RAM. OR InnoDB's innodb_buffer_pool_size should be 70% of available RAM.

answered Apr 10, 2015 at 4:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.