Bug #1409 FLUSH QUERY CACHE doesn't work
Submitted: 26 Sep 2003 7:10 Modified: 26 Sep 2003 17:00
Reporter: Jeremy Cole (Basic Quality Contributor) (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.x OS:?
Assigned to: CPU Architecture:Any

[26 Sep 2003 7:10] Jeremy Cole
Description:
mysql> flush query cache;
Query OK, 0 rows affected (0.00 sec)

mysql> show status like 'Qc%';
+-------------------------+---------+
| Variable_name           | Value   |
+-------------------------+---------+
| Qcache_queries_in_cache | 280     |
| Qcache_inserts          | 18953   |
| Qcache_hits             | 4699    |
| Qcache_lowmem_prunes    | 0       |
| Qcache_not_cached       | 1023    |
| Qcache_free_memory      | 7871040 |
| Qcache_free_blocks      | 1       |
| Qcache_total_blocks     | 582     |
+-------------------------+---------+
8 rows in set (0.00 sec)

How to repeat:
mysql> flush query cache;
Query OK, 0 rows affected (0.00 sec)

mysql> show status like 'Qc%';
+-------------------------+---------+
| Variable_name           | Value   |
+-------------------------+---------+
| Qcache_queries_in_cache | 280     |
| Qcache_inserts          | 18953   |
| Qcache_hits             | 4699    |
| Qcache_lowmem_prunes    | 0       |
| Qcache_not_cached       | 1023    |
| Qcache_free_memory      | 7871040 |
| Qcache_free_blocks      | 1       |
| Qcache_total_blocks     | 582     |
+-------------------------+---------+
8 rows in set (0.00 sec)

Suggested fix:
Make it work :)
[26 Sep 2003 17:00] Alexander Keremidarski
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Jeremy,

Your FLUSH command has nothing to do. 

Qcache_free_blocks is already 1 so it can't be optimized further.

Quoting manual:

With the FLUSH QUERY CACHE command you can defragment the query cache to better utilise its memory. This command will not remove any queries from the cache. FLUSH TABLES also flushes the query cache.

The RESET QUERY CACHE command removes all query results from the query cache