information about different variables agged to query cache (BUG#5515, BUG#5394)
This commit is contained in:
parent
69695656a1
commit
24e1464d5a
@ -851,4 +851,60 @@ select @@character_set_results;
|
|||||||
@@character_set_results
|
@@character_set_results
|
||||||
NULL
|
NULL
|
||||||
set character_set_results=default;
|
set character_set_results=default;
|
||||||
|
set GLOBAL query_cache_size=1355776;
|
||||||
|
create table t1 (id int auto_increment primary key, c char(25));
|
||||||
|
insert into t1 set c = repeat('x',24);
|
||||||
|
insert into t1 set c = concat(repeat('x',24),'x');
|
||||||
|
insert into t1 set c = concat(repeat('x',24),'w');
|
||||||
|
insert into t1 set c = concat(repeat('x',24),'y');
|
||||||
|
set max_sort_length=200;
|
||||||
|
select c from t1 order by c, id;
|
||||||
|
c
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxw
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxy
|
||||||
|
reset query cache;
|
||||||
|
set max_sort_length=20;
|
||||||
|
select c from t1 order by c, id;
|
||||||
|
c
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxw
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxy
|
||||||
|
set max_sort_length=200;
|
||||||
|
select c from t1 order by c, id;
|
||||||
|
c
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxw
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxx
|
||||||
|
xxxxxxxxxxxxxxxxxxxxxxxxy
|
||||||
|
set max_sort_length=default;
|
||||||
|
select '1' || '3' from t1;
|
||||||
|
'1' || '3'
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
set SQL_MODE=oracle;
|
||||||
|
select '1' || '3' from t1;
|
||||||
|
'1' || '3'
|
||||||
|
13
|
||||||
|
13
|
||||||
|
13
|
||||||
|
13
|
||||||
|
set SQL_MODE=default;
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (a varchar(20), b int);
|
||||||
|
insert into t1 values ('12345678901234567890', 1);
|
||||||
|
set group_concat_max_len=10;
|
||||||
|
select group_concat(a) FROM t1 group by b;
|
||||||
|
group_concat(a)
|
||||||
|
1234567890
|
||||||
|
set group_concat_max_len=1024;
|
||||||
|
select group_concat(a) FROM t1 group by b;
|
||||||
|
group_concat(a)
|
||||||
|
12345678901234567890
|
||||||
|
set group_concat_max_len=default;
|
||||||
|
drop table t1;
|
||||||
SET GLOBAL query_cache_size=0;
|
SET GLOBAL query_cache_size=0;
|
||||||
|
@ -627,4 +627,38 @@ set character_set_results=null;
|
|||||||
select @@character_set_results;
|
select @@character_set_results;
|
||||||
set character_set_results=default;
|
set character_set_results=default;
|
||||||
|
|
||||||
|
#
|
||||||
|
# query cache and environment variables
|
||||||
|
#
|
||||||
|
# max_sort_length
|
||||||
|
set GLOBAL query_cache_size=1355776;
|
||||||
|
create table t1 (id int auto_increment primary key, c char(25));
|
||||||
|
insert into t1 set c = repeat('x',24);
|
||||||
|
insert into t1 set c = concat(repeat('x',24),'x');
|
||||||
|
insert into t1 set c = concat(repeat('x',24),'w');
|
||||||
|
insert into t1 set c = concat(repeat('x',24),'y');
|
||||||
|
set max_sort_length=200;
|
||||||
|
select c from t1 order by c, id;
|
||||||
|
reset query cache;
|
||||||
|
set max_sort_length=20;
|
||||||
|
select c from t1 order by c, id;
|
||||||
|
set max_sort_length=200;
|
||||||
|
select c from t1 order by c, id;
|
||||||
|
set max_sort_length=default;
|
||||||
|
# sql_mode
|
||||||
|
select '1' || '3' from t1;
|
||||||
|
set SQL_MODE=oracle;
|
||||||
|
select '1' || '3' from t1;
|
||||||
|
set SQL_MODE=default;
|
||||||
|
drop table t1;
|
||||||
|
# group_concat_max_len
|
||||||
|
create table t1 (a varchar(20), b int);
|
||||||
|
insert into t1 values ('12345678901234567890', 1);
|
||||||
|
set group_concat_max_len=10;
|
||||||
|
select group_concat(a) FROM t1 group by b;
|
||||||
|
set group_concat_max_len=1024;
|
||||||
|
select group_concat(a) FROM t1 group by b;
|
||||||
|
set group_concat_max_len=default;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
SET GLOBAL query_cache_size=0;
|
SET GLOBAL query_cache_size=0;
|
||||||
|
@ -390,6 +390,9 @@ struct Query_cache_query_flags
|
|||||||
uint collation_connection_num;
|
uint collation_connection_num;
|
||||||
ha_rows limit;
|
ha_rows limit;
|
||||||
Time_zone *time_zone;
|
Time_zone *time_zone;
|
||||||
|
ulong sql_mode;
|
||||||
|
ulong max_sort_length;
|
||||||
|
ulong group_concat_max_len;
|
||||||
};
|
};
|
||||||
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
|
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
|
||||||
#include "sql_cache.h"
|
#include "sql_cache.h"
|
||||||
|
@ -787,6 +787,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
|
|||||||
thd->variables.collation_connection->number;
|
thd->variables.collation_connection->number;
|
||||||
flags.limit= thd->variables.select_limit;
|
flags.limit= thd->variables.select_limit;
|
||||||
flags.time_zone= thd->variables.time_zone;
|
flags.time_zone= thd->variables.time_zone;
|
||||||
|
flags.sql_mode= thd->variables.sql_mode;
|
||||||
|
flags.max_sort_length= thd->variables.max_sort_length;
|
||||||
|
flags.group_concat_max_len= thd->variables.group_concat_max_len;
|
||||||
STRUCT_LOCK(&structure_guard_mutex);
|
STRUCT_LOCK(&structure_guard_mutex);
|
||||||
|
|
||||||
if (query_cache_size == 0)
|
if (query_cache_size == 0)
|
||||||
@ -974,6 +977,9 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
|||||||
flags.collation_connection_num= thd->variables.collation_connection->number;
|
flags.collation_connection_num= thd->variables.collation_connection->number;
|
||||||
flags.limit= thd->variables.select_limit;
|
flags.limit= thd->variables.select_limit;
|
||||||
flags.time_zone= thd->variables.time_zone;
|
flags.time_zone= thd->variables.time_zone;
|
||||||
|
flags.sql_mode= thd->variables.sql_mode;
|
||||||
|
flags.max_sort_length= thd->variables.max_sort_length;
|
||||||
|
flags.group_concat_max_len= thd->variables.group_concat_max_len;
|
||||||
memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
|
memcpy((void *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)),
|
||||||
&flags, QUERY_CACHE_FLAGS_SIZE);
|
&flags, QUERY_CACHE_FLAGS_SIZE);
|
||||||
query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql,
|
query_block = (Query_cache_block *) hash_search(&queries, (byte*) sql,
|
||||||
|
@ -53,10 +53,6 @@
|
|||||||
of list of free blocks */
|
of list of free blocks */
|
||||||
#define QUERY_CACHE_MEM_BIN_TRY 5
|
#define QUERY_CACHE_MEM_BIN_TRY 5
|
||||||
|
|
||||||
/* query flags masks */
|
|
||||||
#define QUERY_CACHE_CLIENT_LONG_FLAG_MASK 0x80
|
|
||||||
#define QUERY_CACHE_CHARSET_CONVERT_MASK 0x7F
|
|
||||||
|
|
||||||
/* packing parameters */
|
/* packing parameters */
|
||||||
#define QUERY_CACHE_PACK_ITERATION 2
|
#define QUERY_CACHE_PACK_ITERATION 2
|
||||||
#define QUERY_CACHE_PACK_LIMIT (512*1024L)
|
#define QUERY_CACHE_PACK_LIMIT (512*1024L)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user