When is the MySQL query cache cleared?

I have an innodb mysql db, I wanted to know if the query cache will be cleared of any changes to the table or will it flush when only those records are changed?

I have a large table that changes every few minutes, so I'm wondering how useful it is.

thank

+3


source to share


1 answer


I don't think you are talking about Query Cache , but Buffer Cache .
The query cache is a cache of the most recent SQL statements that are never flushed to disk.

Clearing the buffer cache is not as important as clearing the buffer log ... The log keeps track of updates made on data inside your database. It is used to recover the db in case of failure, i.e. when the buffer cache is not flushed to disk.

There are 3 main ways to flush the buffer log in InnoDB and they are controlled by a parameter innodb_flush_log_at_trx_commit

.
Quoting the MySQL docs:



"If you can afford to lose some of the last committed transactions if a failure occurs, you can set the innodb_flush_log_at_trx_commit parameter to 0. InnoDB tries to flush the log once a second anyway, although the flash is not. Also, set the innodb_support_xa value to 0. which will reduce the number of flash drives due to the synchronization of data on the disk and the binary log. "

Source: http://dev.mysql.com/doc/refman/5.1/en/innodb-tuning.html

Hope it helps

+2


source







All Articles