summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2017-06-18 09:58:13 +0300
committerSergei Golubchik <serg@mariadb.org>2017-08-24 01:05:49 +0200
commit8bfda2f0af5075fab2dd481a5a29d770e161d3c1 (patch)
tree841216c75e51d0104b85e415fb3c694a98b6a19d /sql/sql_cache.cc
parent1ed605e49090a216e01fcddc3078c890a0c1c14b (diff)
downloadmariadb-git-8bfda2f0af5075fab2dd481a5a29d770e161d3c1.tar.gz
Simplify test if we can use table in query cache
- Added TABLE_SHARE->not_usable_by_query_cache - Moved TABLE->no_replicate to TABLE_SHARE->no_replicate as it's same for all TABLE instances - Renamed TABLE_SHARE->cached_row_logging_check to can_do_row_logging
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc58
1 files changed, 26 insertions, 32 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 41c3ee33cfd..2ef20268e14 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -4050,41 +4050,35 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
tables_used->view_name.str,
tables_used->view_db.str));
*tables_type|= HA_CACHE_TBL_NONTRANSACT;
+ continue;
}
- else
+ if (tables_used->derived)
{
- if (tables_used->derived)
- {
- DBUG_PRINT("qcache", ("table: %s", tables_used->alias));
- table_count--;
- DBUG_PRINT("qcache", ("derived table skipped"));
- continue;
- }
- DBUG_PRINT("qcache", ("table: %s db: %s type: %u",
- tables_used->table->s->table_name.str,
- tables_used->table->s->db.str,
- tables_used->table->s->db_type()->db_type));
- *tables_type|= tables_used->table->file->table_cache_type();
+ DBUG_PRINT("qcache", ("table: %s", tables_used->alias));
+ table_count--;
+ DBUG_PRINT("qcache", ("derived table skipped"));
+ continue;
+ }
- /*
- table_alias_charset used here because it depends of
- lower_case_table_names variable
- */
- table_count+= tables_used->table->file->
- count_query_cache_dependant_tables(tables_type);
-
- if (tables_used->table->s->tmp_table != NO_TMP_TABLE ||
- (*tables_type & HA_CACHE_TBL_NOCACHE) ||
- (tables_used->db_length == 5 &&
- my_strnncoll(table_alias_charset,
- (uchar*)tables_used->table->s->table_cache_key.str, 6,
- (uchar*)"mysql",6) == 0))
- {
- DBUG_PRINT("qcache",
- ("select not cacheable: temporary, system or "
- "other non-cacheable table(s)"));
- DBUG_RETURN(0);
- }
+ DBUG_PRINT("qcache", ("table: %s db: %s type: %u",
+ tables_used->table->s->table_name.str,
+ tables_used->table->s->db.str,
+ tables_used->table->s->db_type()->db_type));
+ *tables_type|= tables_used->table->file->table_cache_type();
+
+ /*
+ table_alias_charset used here because it depends of
+ lower_case_table_names variable
+ */
+ table_count+= tables_used->table->file->
+ count_query_cache_dependant_tables(tables_type);
+
+ if (tables_used->table->s->not_usable_by_query_cache)
+ {
+ DBUG_PRINT("qcache",
+ ("select not cacheable: temporary, system or "
+ "other non-cacheable table(s)"));
+ DBUG_RETURN(0);
}
}
DBUG_RETURN(table_count);