79712642

Date: 2025-07-23 23:18:02
Score: 0.5
Natty:
Report link

If you have a table with many INSERTs and also frequent SELECTs, it's common to see INSERT operations waiting for cache, which can cause delays. This happens because SELECT queries can lock or slow down INSERTs. A good practice is to use SQL_NO_CACHE in SELECT statements on tables with heavy insert activity. InnoDB also recommends using uncached queries in such cases. Of course, if your workload is mostly SELECTs and rarely updated, caching is beneficial — especially when the query cache hit ratio is over 90%. But for large tables with frequent inserts, it's better to disable caching for those SELECTs using SQL_NO_CACHE. Disabling the whole query cache isn't ideal unless you're ready to redesign the software (e.g. using Redis), so using SQL_NO_CACHE is a simple and effective optimization for improving INSERT performance.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Kamil Dąbrowski