Bug #32213 Impossible high query cache setting resets cache size to 0 bytes
Submitted: 9 Nov 2007 9:17 Modified: 7 Jul 2017 9:12
Reporter: Jens Bollmann Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Query Cache Severity:S3 (Non-critical)
Version:5.0.45 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[9 Nov 2007 9:17] Jens Bollmann
Description:
Setting the query cache size to high will resize the cache to 0.

Why not leaving the cache size on the original value?

How to repeat:
On a 1GB server:

34:root@localhost [test]> set  global query_cache_size=2*1024*1024*1024;
Query OK, 0 rows affected, 1 warning (0.38 sec)

35:root@localhost [test]> show warnings;
+---------+------+--------------------------------------------------------------
--------+
| Level   | Code | Message
        |
+---------+------+--------------------------------------------------------------
--------+
| Warning | 1282 | Query cache failed to set size 2147483648; new query cache si
ze is 0 |
+---------+------+--------------------------------------------------------------
--------+
1 row in set (0.00 sec)

36:root@localhost [test]> show variables like 'quer%';
+------------------------------+---------+
| Variable_name                | Value   |
+------------------------------+---------+
| query_alloc_block_size       | 8192    |
| query_cache_limit            | 1048576 |
| query_cache_min_res_unit     | 4096    |
| query_cache_size             | 0       |
| query_cache_type             | ON      |
| query_cache_wlock_invalidate | OFF     |
| query_prealloc_size          | 8192    |
+------------------------------+---------+
7 rows in set (0.00 sec)

Suggested fix:
Set the query_cache to the original value.
[9 Nov 2007 10:26] MySQL Verification Team
Thank you for the bug report.
[23 Nov 2007 12:31] Kristofer Pettersson
The manual shows this behavior by example. It is not a bug, but perhaps not a very good behavior. I'm submitting a simple patch for future discussions.
[23 Nov 2007 12:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38360

ChangeSet@1.2537, 2007-11-23 13:38:13+01:00, thek@adventure.(none) +3 -0
  Bug #32213 Impossible high query cache setting resets cache size to 0 bytes
  
  PREVIEW PATCH 
  
  Setting the query cache size to high will resize the cache to 0.
  Why not leaving the cache size on the original value?
[26 Jan 2009 14:19] Mattias Jonsson
Marked bug#20988 as a duplicate of this.
[7 Jul 2017 9:12] Erlend Dahl
MySQL will no longer invest in the query cache, see:

http://mysqlserverteam.com/mysql-8-0-retiring-support-for-the-query-cache/