diff options
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 0c8716120da..c25a7e5afe4 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1274,10 +1274,11 @@ ulong Query_cache::init_cache() query_cache_size -= additional_data_size; STRUCT_LOCK(&structure_guard_mutex); - if (query_cache_size <= min_allocation_unit) + if (max_mem_bin_size <= min_allocation_unit) { DBUG_PRINT("qcache", - (" query_cache_size <= min_allocation_unit => cache disabled")); + (" max bin size (%lu) <= min_allocation_unit => cache disabled", + max_mem_bin_size)); STRUCT_UNLOCK(&structure_guard_mutex); goto err; } @@ -2392,7 +2393,6 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, DBUG_ENTER("Query_cache::is_cacheable"); if (lex->sql_command == SQLCOM_SELECT && - thd->temporary_tables == 0 && (thd->variables.query_cache_type == 1 || (thd->variables.query_cache_type == 2 && (lex->select->options & OPTION_TO_QUERY_CACHE))) && @@ -2413,9 +2413,11 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, has_transactions = (has_transactions || tables_used->table->file->has_transactions()); - if (tables_used->table->db_type == DB_TYPE_MRG_ISAM) + if (tables_used->table->db_type == DB_TYPE_MRG_ISAM || + tables_used->table->tmp_table != NO_TMP_TABLE) { - DBUG_PRINT("qcache", ("select not cacheable: used MRG_ISAM table(s)")); + DBUG_PRINT("qcache", + ("select not cacheable: used MRG_ISAM or temporary table(s)")); DBUG_RETURN(0); } if (tables_used->table->db_type == DB_TYPE_MRG_MYISAM) |