2003-09-15 14:16:13 +02:00
|
|
|
|
set GLOBAL query_cache_size=1355776;
|
2001-12-13 01:31:19 +01:00
|
|
|
|
flush query cache;
|
|
|
|
|
flush query cache;
|
2001-12-06 00:05:30 +01:00
|
|
|
|
reset query cache;
|
|
|
|
|
flush status;
|
2006-02-26 14:11:56 +01:00
|
|
|
|
drop table if exists t1,t2,t3,t4,t11,t21,t1_1,t1_2,t9,t9_1,t9_2;
|
2003-01-06 00:48:59 +01:00
|
|
|
|
drop database if exists mysqltest;
|
Table definition cache, part 2
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
object and open a handler to the table object
Other noteworthy changes:
- In TABLE_SHARE the most common strings are now LEX_STRING's
- Better error message when table is not found
- Variable table_cache is now renamed 'table_open_cache'
- New variable 'table_definition_cache' that is the number of table defintions that will be cached
- strxnmov() calls are now fixed to avoid overflows
- strxnmov() will now always add one end \0 to result
- engine objects are now created with a TABLE_SHARE object instead of a TABLE object.
- After creating a field object one must call field->init(table) before using it
- For a busy system this change will give you:
- Less memory usage for table object
- Faster opening of tables (if it's has been in use or is in table definition cache)
- Allow you to cache many table definitions objects
- Faster drop of table
mysql-test/mysql-test-run.sh:
Fixed some problems with --gdb option
Test both with socket and tcp/ip port that all old servers are killed
mysql-test/r/flush_table.result:
More tests with lock table with 2 threads + flush table
mysql-test/r/information_schema.result:
Removed old (now wrong) result
mysql-test/r/innodb.result:
Better error messages (thanks to TDC patch)
mysql-test/r/merge.result:
Extra flush table test
mysql-test/r/ndb_bitfield.result:
Better error messages (thanks to TDC patch)
mysql-test/r/ndb_partition_error.result:
Better error messages (thanks to TDC patch)
mysql-test/r/query_cache.result:
Remove tables left from old tests
mysql-test/r/temp_table.result:
Test truncate with temporary tables
mysql-test/r/variables.result:
Table_cache -> Table_open_cache
mysql-test/t/flush_table.test:
More tests with lock table with 2 threads + flush table
mysql-test/t/merge.test:
Extra flush table test
mysql-test/t/multi_update.test:
Added 'sleep' to make test predictable
mysql-test/t/query_cache.test:
Remove tables left from old tests
mysql-test/t/temp_table.test:
Test truncate with temporary tables
mysql-test/t/variables.test:
Table_cache -> Table_open_cache
mysql-test/valgrind.supp:
Remove warning that may happens becasue threads dies in different order
mysys/hash.c:
Fixed wrong DBUG_PRINT
mysys/mf_dirname.c:
More DBUG
mysys/mf_pack.c:
Better comment
mysys/mf_tempdir.c:
More DBUG
Ensure that we call cleanup_dirname() on all temporary directory paths.
If we don't do this, we will get a failure when comparing temporary table
names as in some cases the temporary table name is run through convert_dirname())
mysys/my_alloc.c:
Indentation fix
sql/examples/ha_example.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_example.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_tina.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/examples/ha_tina.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/field.cc:
Update for table definition cache:
- Field creation now takes TABLE_SHARE instead of TABLE as argument
(This is becasue field definitions are now cached in TABLE_SHARE)
When a field is created, one now must call field->init(TABLE) before using it
- Use s->db instead of s->table_cache_key
- Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE
- make_field() takes TABLE_SHARE as argument instead of TABLE
- move_field() -> move_field_offset()
sql/field.h:
Update for table definition cache:
- Field creation now takes TABLE_SHARE instead of TABLE as argument
(This is becasue field definitions are now cached in TABLE_SHARE)
When a field is created, one now must call field->init(TABLE) before using it
- Added Field::clone() to create a field in TABLE from a field in TABLE_SHARE
- make_field() takes TABLE_SHARE as argument instead of TABLE
- move_field() -> move_field_offset()
sql/ha_archive.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_archive.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_berkeley.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Changed name of argument create() to not hide internal 'table' variable.
table->s -> table_share
sql/ha_berkeley.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_blackhole.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_blackhole.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_federated.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Fixed comments
Remove index variable and replace with pointers (simple optimization)
move_field() -> move_field_offset()
Removed some strlen() calls
sql/ha_federated.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_heap.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Simplify delete_table() and create() as the given file names are now without extension
sql/ha_heap.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_innodb.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_innodb.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_myisam.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Remove not needed fn_format()
Fixed for new table->s structure
sql/ha_myisam.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_myisammrg.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Don't set 'is_view' for MERGE tables
Use new interface to find_temporary_table()
sql/ha_myisammrg.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Added flag HA_NO_COPY_ON_ALTER
sql/ha_ndbcluster.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Fixed wrong calls to strxnmov()
Give error HA_ERR_TABLE_DEF_CHANGED if table definition has changed
drop_table -> intern_drop_table()
table->s -> table_share
Move part_info to TABLE
Fixed comments & DBUG print's
New arguments to print_error()
sql/ha_ndbcluster.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
sql/ha_partition.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
We can't set up or use part_info when creating handler as there is not yet any table object
New ha_intialise() to work with TDC (Done by Mikael)
sql/ha_partition.h:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
Got set_part_info() from Mikael
sql/handler.cc:
We new use TABLE_SHARE instead of TABLE when creating engine handlers
ha_delete_table() now also takes database as an argument
handler::ha_open() now takes TABLE as argument
ha_open() now calls ha_allocate_read_write_set()
Simplify ha_allocate_read_write_set()
Remove ha_deallocate_read_write_set()
Use table_share (Cached by table definition cache)
sql/handler.h:
New table flag: HA_NO_COPY_ON_ALTER (used by merge tables)
Remove ha_deallocate_read_write_set()
get_new_handler() now takes TABLE_SHARE as argument
ha_delete_table() now gets database as argument
sql/item.cc:
table_name and db are now LEX_STRING objects
When creating fields, we have now have to call field->init(table)
move_field -> move_field_offset()
sql/item.h:
tmp_table_field_from_field_type() now takes an extra paramenter 'fixed_length' to allow one to force usage of CHAR
instead of BLOB
sql/item_cmpfunc.cc:
Fixed call to tmp_table_field_from_field_type()
sql/item_create.cc:
Assert if new not handled cast type
sql/item_func.cc:
When creating fields, we have now have to call field->init(table)
dummy_table used by 'sp' now needs a TABLE_SHARE object
sql/item_subselect.cc:
Trivial code cleanups
sql/item_sum.cc:
When creating fields, we have now have to call field->init(table)
sql/item_timefunc.cc:
Item_func_str_to_date::tmp_table_field() now replaced by call to
tmp_table_field_from_field_type() (see item_timefunc.h)
sql/item_timefunc.h:
Simply tmp_table_field()
sql/item_uniq.cc:
When creating fields, we have now have to call field->init(table)
sql/key.cc:
Added 'KEY' argument to 'find_ref_key' to simplify code
sql/lock.cc:
More debugging
Use create_table_def_key() to create key for table cache
Allocate TABLE_SHARE properly when creating name lock
Fix that locked_table_name doesn't test same table twice
sql/mysql_priv.h:
New functions for table definition cache
New interfaces to a lot of functions.
New faster interface to find_temporary_table() and close_temporary_table()
sql/mysqld.cc:
Added support for table definition cache of size 'table_def_size'
Fixed som calls to strnmov()
Changed name of 'table_cache' to 'table_open_cache'
sql/opt_range.cc:
Use new interfaces
Fixed warnings from valgrind
sql/parse_file.cc:
Safer calls to strxnmov()
Fixed typo
sql/set_var.cc:
Added variable 'table_definition_cache'
Variable table_cache renamed to 'table_open_cache'
sql/slave.cc:
Use new interface
sql/sp.cc:
Proper use of TABLE_SHARE
sql/sp_head.cc:
Remove compiler warnings
We have now to call field->init(table)
sql/sp_head.h:
Pointers to parsed strings are now const
sql/sql_acl.cc:
table_name is now a LEX_STRING
sql/sql_base.cc:
Main implementation of table definition cache
(The #ifdef's are there for the future when table definition cache will replace open table cache)
Now table definitions are cached indepndent of open tables, which will speed up things when a table is in use at once from several places
Views are not yet cached; For the moment we only cache if a table is a view or not.
Faster implementation of find_temorary_table()
Replace 'wait_for_refresh()' with the more general function 'wait_for_condition()'
Drop table is slightly faster as we can use the table definition cache to know the type of the table
sql/sql_cache.cc:
table_cache_key and table_name are now LEX_STRING
'sDBUG print fixes
sql/sql_class.cc:
table_cache_key is now a LEX_STRING
safer strxnmov()
sql/sql_class.h:
Added number of open table shares (table definitions)
sql/sql_db.cc:
safer strxnmov()
sql/sql_delete.cc:
Use new interface to find_temporary_table()
sql/sql_derived.cc:
table_name is now a LEX_STRING
sql/sql_handler.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
sql/sql_insert.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
sql/sql_lex.cc:
Make parsed string a const (to quickly find out if anything is trying to change the query string)
sql/sql_lex.h:
Make parsed string a const (to quickly find out if anything is trying to change the query string)
sql/sql_load.cc:
Safer strxnmov()
sql/sql_parse.cc:
Better error if wrong DB name
sql/sql_partition.cc:
part_info moved to TABLE from TABLE_SHARE
Indentation changes
sql/sql_select.cc:
Indentation fixes
Call field->init(TABLE) for new created fields
Update create_tmp_table() to use TABLE_SHARE properly
sql/sql_select.h:
Call field->init(TABLE) for new created fields
sql/sql_show.cc:
table_name is now a LEX_STRING
part_info moved to TABLE
sql/sql_table.cc:
Use table definition cache to speed up delete of tables
Fixed calls to functions with new interfaces
Don't use 'share_not_to_be_used'
Instead of doing openfrm() when doing repair, we now have to call
get_table_share() followed by open_table_from_share().
Replace some fn_format() with faster unpack_filename().
Safer strxnmov()
part_info is now in TABLE
Added Mikaels patch for partition and ALTER TABLE
Instead of using 'TABLE_SHARE->is_view' use 'table_flags() & HA_NO_COPY_ON_ALTER
sql/sql_test.cc:
table_name and table_cache_key are now LEX_STRING's
sql/sql_trigger.cc:
TABLE_SHARE->db and TABLE_SHARE->table_name are now LEX_STRING's
safer strxnmov()
Removed compiler warnings
sql/sql_update.cc:
Call field->init(TABLE) after field is created
sql/sql_view.cc:
safer strxnmov()
Create common TABLE_SHARE object for views to allow us to cache if table is a view
sql/structs.h:
Added SHOW_TABLE_DEFINITIONS
sql/table.cc:
Creation and destruct of TABLE_SHARE objects that are common for many TABLE objects
The table opening process now works the following way:
- Create common TABLE_SHARE object
- Read the .frm file and unpack it into the TABLE_SHARE object
- Create a TABLE object based on the information in the TABLE_SHARE
object and open a handler to the table object
open_table_def() is written in such a way that it should be trival to add parsing of the .frm files in new formats
sql/table.h:
TABLE objects for the same database table now share a common TABLE_SHARE object
In TABLE_SHARE the most common strings are now LEX_STRING's
sql/unireg.cc:
Changed arguments to rea_create_table() to have same order as other functions
Call field->init(table) for new created fields
sql/unireg.h:
Added OPEN_VIEW
strings/strxnmov.c:
Change strxnmov() to always add end \0
This makes usage of strxnmov() safer as most of MySQL code assumes that strxnmov() will create a null terminated string
2005-11-23 21:45:02 +01:00
|
|
|
|
drop table if exists ```a`;
|
|
|
|
|
drop view if exists v1;
|
2001-12-06 00:05:30 +01:00
|
|
|
|
create table t1 (a int not null);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select sql_no_cache * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select length(now()) from t1;
|
|
|
|
|
length(now())
|
|
|
|
|
19
|
|
|
|
|
19
|
|
|
|
|
19
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 1
|
|
|
|
|
drop table t1;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
2007-08-08 17:56:15 +02:00
|
|
|
|
create table t1 (a int not null) ENGINE=MyISAM;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
insert into t1 values (1),(2),(3);
|
2007-08-08 17:56:15 +02:00
|
|
|
|
create table t2 (a int not null) ENGINE=MyISAM;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
insert into t2 values (4),(5),(6);
|
2003-12-10 05:31:42 +01:00
|
|
|
|
create table t3 (a int not null) engine=MERGE UNION=(t1,t2) INSERT_METHOD=FIRST;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
select * from t3;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
|
select * from t3;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 2
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
insert into t2 values (7);
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 3
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
insert into t3 values (8);
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select * from t3;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
8
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
update t2 set a=9 where a=7;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
8
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
update t3 set a=10 where a=1;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select * from t3;
|
|
|
|
|
a
|
|
|
|
|
10
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
8
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
|
9
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
delete from t2 where a=9;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
10
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
8
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
delete from t3 where a=10;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
drop table t1, t2, t3;
|
2002-07-23 17:31:22 +02:00
|
|
|
|
set query_cache_type=demand;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
create table t1 (a int not null);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
2003-02-27 21:26:09 +01:00
|
|
|
|
select sql_cache * from t1 union select * from t1;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
2002-07-23 17:31:22 +02:00
|
|
|
|
set query_cache_type=2;
|
2003-02-27 21:26:09 +01:00
|
|
|
|
select sql_cache * from t1 union select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1 union select sql_cache * from t1;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
Changed code to enforce that SQL_CACHE only in the first SELECT is used to turn on caching(as documented), but any SQL_NO_CACHE will turn off caching (not documented, but a useful behaviour, especially for machine generated queries). Added test cases to explicitly test the documented caching behaviour and test cases for the reported bug.
mysql-test/r/query_cache.result:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
mysql-test/t/query_cache.test:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
sql/sql_yacc.yy:
Added an explicit check to make sure "SELECT SQL_CACHE" only works on the first select in a query.
The parser will always hit the outermost SELECT first, and if the SQL_CACHE option is found it sets the safe_to_query flag in the lex. Then, if there are subseqent "uncachable" subqueries or functions, as it parses those elements it sets the safe_to_query to 0. However, this cause problems if nested SELECTs also used the SQL_CACHE option, because then it would set back safe_to_query to 1, even though there are uncacheable expressions previously parsed.
By adding the check to ensure only the first SELECT can turn caching on, it means a subsequent SQL_CACHE option can't turn caching back on after a uncacheable subsequery was already encountered.
2007-06-18 23:16:20 +02:00
|
|
|
|
select * from t1 where a IN (select sql_cache a from t1);
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
2001-12-09 23:08:24 +01:00
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 4
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
Changed code to enforce that SQL_CACHE only in the first SELECT is used to turn on caching(as documented), but any SQL_NO_CACHE will turn off caching (not documented, but a useful behaviour, especially for machine generated queries). Added test cases to explicitly test the documented caching behaviour and test cases for the reported bug.
mysql-test/r/query_cache.result:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
mysql-test/t/query_cache.test:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
sql/sql_yacc.yy:
Added an explicit check to make sure "SELECT SQL_CACHE" only works on the first select in a query.
The parser will always hit the outermost SELECT first, and if the SQL_CACHE option is found it sets the safe_to_query flag in the lex. Then, if there are subseqent "uncachable" subqueries or functions, as it parses those elements it sets the safe_to_query to 0. However, this cause problems if nested SELECTs also used the SQL_CACHE option, because then it would set back safe_to_query to 1, even though there are uncacheable expressions previously parsed.
By adding the check to ensure only the first SELECT can turn caching on, it means a subsequent SQL_CACHE option can't turn caching back on after a uncacheable subsequery was already encountered.
2007-06-18 23:16:20 +02:00
|
|
|
|
Qcache_queries_in_cache 1
|
2002-07-23 17:31:22 +02:00
|
|
|
|
set query_cache_type=on;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
reset query cache;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select sql_no_cache * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
Changed code to enforce that SQL_CACHE only in the first SELECT is used to turn on caching(as documented), but any SQL_NO_CACHE will turn off caching (not documented, but a useful behaviour, especially for machine generated queries). Added test cases to explicitly test the documented caching behaviour and test cases for the reported bug.
mysql-test/r/query_cache.result:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
mysql-test/t/query_cache.test:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
sql/sql_yacc.yy:
Added an explicit check to make sure "SELECT SQL_CACHE" only works on the first select in a query.
The parser will always hit the outermost SELECT first, and if the SQL_CACHE option is found it sets the safe_to_query flag in the lex. Then, if there are subseqent "uncachable" subqueries or functions, as it parses those elements it sets the safe_to_query to 0. However, this cause problems if nested SELECTs also used the SQL_CACHE option, because then it would set back safe_to_query to 1, even though there are uncacheable expressions previously parsed.
By adding the check to ensure only the first SELECT can turn caching on, it means a subsequent SQL_CACHE option can't turn caching back on after a uncacheable subsequery was already encountered.
2007-06-18 23:16:20 +02:00
|
|
|
|
select * from t1 union select sql_no_cache * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1 where a IN (select sql_no_cache a from t1);
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select sql_cache sql_no_cache * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select sql_cache * from t1 union select sql_no_cache * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
2001-12-09 23:08:24 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
drop table t1;
|
|
|
|
|
create table t1 (a text not null);
|
|
|
|
|
select CONNECTION_ID() from t1;
|
|
|
|
|
CONNECTION_ID()
|
|
|
|
|
select FOUND_ROWS();
|
|
|
|
|
FOUND_ROWS()
|
|
|
|
|
0
|
|
|
|
|
select NOW() from t1;
|
|
|
|
|
NOW()
|
|
|
|
|
select CURDATE() from t1;
|
|
|
|
|
CURDATE()
|
|
|
|
|
select CURTIME() from t1;
|
|
|
|
|
CURTIME()
|
|
|
|
|
select DATABASE() from t1;
|
|
|
|
|
DATABASE()
|
|
|
|
|
select ENCRYPT("test") from t1;
|
|
|
|
|
ENCRYPT("test")
|
|
|
|
|
select LAST_INSERT_ID() from t1;
|
2004-03-25 17:42:13 +01:00
|
|
|
|
LAST_INSERT_ID()
|
2001-12-09 23:08:24 +01:00
|
|
|
|
select RAND() from t1;
|
|
|
|
|
RAND()
|
|
|
|
|
select UNIX_TIMESTAMP() from t1;
|
|
|
|
|
UNIX_TIMESTAMP()
|
|
|
|
|
select USER() from t1;
|
|
|
|
|
USER()
|
2005-04-10 22:30:23 +02:00
|
|
|
|
select CURRENT_USER() from t1;
|
|
|
|
|
CURRENT_USER()
|
2001-12-09 23:08:24 +01:00
|
|
|
|
select benchmark(1,1) from t1;
|
|
|
|
|
benchmark(1,1)
|
2003-10-30 11:57:26 +01:00
|
|
|
|
explain extended select benchmark(1,1) from t1;
|
2006-07-28 19:27:01 +02:00
|
|
|
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
|
|
|
|
1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found
|
2003-10-30 11:57:26 +01:00
|
|
|
|
Warnings:
|
2006-06-27 19:28:32 +02:00
|
|
|
|
Note 1003 select benchmark(1,1) AS `benchmark(1,1)` from `test`.`t1`
|
2001-12-09 23:08:24 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
create table t2 (a text not null);
|
|
|
|
|
insert into t1 values("1111111111111111111111111111111111111111111111111111");
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 4
|
2002-11-17 19:41:25 +01:00
|
|
|
|
show status like "Qcache_lowmem_prunes";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_lowmem_prunes 0
|
2001-12-09 23:08:24 +01:00
|
|
|
|
select a as a1, a as a2 from t1;
|
|
|
|
|
select a as a2, a as a3 from t1;
|
|
|
|
|
select a as a3, a as a4 from t1;
|
|
|
|
|
select a as a1, a as a2 from t1;
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 4
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
2002-11-17 19:41:25 +01:00
|
|
|
|
show status like "Qcache_lowmem_prunes";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_lowmem_prunes 2
|
2001-12-09 23:08:24 +01:00
|
|
|
|
reset query cache;
|
2001-12-14 15:02:41 +01:00
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
|
select * from t1;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
drop table t1,t2;
|
2003-07-03 10:55:36 +02:00
|
|
|
|
create database mysqltest;
|
2001-12-22 14:13:31 +01:00
|
|
|
|
create table mysqltest.t1 (i int not null auto_increment, a int, primary key (i));
|
|
|
|
|
insert into mysqltest.t1 (a) values (1);
|
|
|
|
|
select * from mysqltest.t1 where i is null;
|
2001-12-14 15:02:41 +01:00
|
|
|
|
i a
|
|
|
|
|
1 1
|
2003-11-20 17:12:49 +01:00
|
|
|
|
create table t1(a int);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
2001-12-22 14:13:31 +01:00
|
|
|
|
select * from mysqltest.t1;
|
2001-12-14 15:02:41 +01:00
|
|
|
|
i a
|
|
|
|
|
1 1
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
2003-11-20 17:12:49 +01:00
|
|
|
|
Qcache_queries_in_cache 2
|
2001-12-22 14:13:31 +01:00
|
|
|
|
drop database mysqltest;
|
2001-12-14 15:02:41 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
2003-11-20 17:12:49 +01:00
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
drop table t1;
|
2003-07-28 17:28:44 +02:00
|
|
|
|
create table t1 (a char(1) not null collate koi8r_general_ci);
|
|
|
|
|
insert into t1 values(_koi8r"<22>");
|
|
|
|
|
set CHARACTER SET koi8r;
|
2001-12-14 15:02:41 +01:00
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
<EFBFBD>
|
|
|
|
|
set CHARACTER SET cp1251_koi8;
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
2003-07-28 17:28:44 +02:00
|
|
|
|
<EFBFBD>
|
2001-12-14 15:02:41 +01:00
|
|
|
|
set CHARACTER SET DEFAULT;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_queries_in_cache 2
|
2001-12-23 01:43:46 +01:00
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 4
|
2001-12-23 01:43:46 +01:00
|
|
|
|
drop table t1;
|
|
|
|
|
create database if not exists mysqltest;
|
|
|
|
|
create table mysqltest.t1 (i int not null);
|
|
|
|
|
create table t1 (i int not null);
|
|
|
|
|
insert into mysqltest.t1 (i) values (1);
|
|
|
|
|
insert into t1 (i) values (2);
|
|
|
|
|
select * from t1;
|
|
|
|
|
i
|
|
|
|
|
2
|
|
|
|
|
use mysqltest;
|
|
|
|
|
select * from t1;
|
|
|
|
|
i
|
|
|
|
|
1
|
|
|
|
|
select * from t1;
|
|
|
|
|
i
|
|
|
|
|
1
|
|
|
|
|
use test;
|
|
|
|
|
select * from t1;
|
|
|
|
|
i
|
|
|
|
|
2
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 6
|
2001-12-23 01:43:46 +01:00
|
|
|
|
drop database mysqltest;
|
2001-12-09 23:08:24 +01:00
|
|
|
|
drop table t1;
|
2002-01-02 20:29:41 +01:00
|
|
|
|
create table t1 (i int not null);
|
|
|
|
|
insert into t1 (i) values (1),(2),(3),(4);
|
|
|
|
|
select SQL_CALC_FOUND_ROWS * from t1 limit 2;
|
|
|
|
|
i
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
select FOUND_ROWS();
|
|
|
|
|
FOUND_ROWS()
|
|
|
|
|
4
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 6
|
2002-01-02 20:29:41 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
select * from t1 where i=1;
|
|
|
|
|
i
|
|
|
|
|
1
|
|
|
|
|
select FOUND_ROWS();
|
|
|
|
|
FOUND_ROWS()
|
|
|
|
|
1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 6
|
2002-01-02 20:29:41 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
select SQL_CALC_FOUND_ROWS * from t1 limit 2;
|
|
|
|
|
i
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
select FOUND_ROWS();
|
|
|
|
|
FOUND_ROWS()
|
|
|
|
|
4
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 7
|
2002-01-02 20:29:41 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
select * from t1 where i=1;
|
|
|
|
|
i
|
|
|
|
|
1
|
|
|
|
|
select FOUND_ROWS();
|
|
|
|
|
FOUND_ROWS()
|
|
|
|
|
1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 8
|
2002-01-02 20:29:41 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
drop table t1;
|
2001-12-20 05:14:11 +01:00
|
|
|
|
flush query cache;
|
|
|
|
|
reset query cache;
|
2007-08-08 17:56:15 +02:00
|
|
|
|
create table t1 (a int not null) ENGINE=MyISAM;
|
2001-12-20 05:14:11 +01:00
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
insert delayed into t1 values (4);
|
|
|
|
|
select a from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
drop table t1;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
2003-03-02 20:39:03 +01:00
|
|
|
|
show global variables like "query_cache_min_res_unit";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_min_res_unit 4096
|
|
|
|
|
set GLOBAL query_cache_min_res_unit=1001;
|
|
|
|
|
show global variables like "query_cache_min_res_unit";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_min_res_unit 1008
|
|
|
|
|
create table t1 (a int not null);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
create table t2 (a int not null);
|
|
|
|
|
insert into t2 values (1),(2),(3);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t2;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select * from t2;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 11
|
2003-03-02 20:39:03 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
drop table t1;
|
|
|
|
|
select a from t2;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
select a from t2;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-07-28 17:28:44 +02:00
|
|
|
|
Qcache_hits 12
|
2003-03-02 20:39:03 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
drop table t2;
|
|
|
|
|
set GLOBAL query_cache_min_res_unit=default;
|
|
|
|
|
show global variables like "query_cache_min_res_unit";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_min_res_unit 4096
|
2003-07-28 17:28:44 +02:00
|
|
|
|
create table t1 (a int not null);
|
|
|
|
|
insert into t1 values (1);
|
|
|
|
|
select "aaa" from t1;
|
|
|
|
|
aaa
|
|
|
|
|
aaa
|
|
|
|
|
select "AAA" from t1;
|
|
|
|
|
AAA
|
|
|
|
|
AAA
|
|
|
|
|
drop table t1;
|
2003-06-04 22:17:01 +02:00
|
|
|
|
create table t1 (a int);
|
2002-07-28 21:36:34 +02:00
|
|
|
|
set GLOBAL query_cache_size=1000;
|
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 0
|
2003-05-31 00:41:11 +02:00
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=1024;
|
2003-10-08 23:13:15 +02:00
|
|
|
|
Warnings:
|
2004-06-15 22:38:36 +02:00
|
|
|
|
Warning 1282 Query cache failed to set size 1024; new query cache size is 0
|
2003-05-31 00:41:11 +02:00
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=10240;
|
2003-10-08 23:13:15 +02:00
|
|
|
|
Warnings:
|
2004-06-15 22:38:36 +02:00
|
|
|
|
Warning 1282 Query cache failed to set size 10240; new query cache size is 0
|
2002-07-28 21:36:34 +02:00
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
2003-05-31 00:41:11 +02:00
|
|
|
|
query_cache_size 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=20480;
|
2003-10-08 23:13:15 +02:00
|
|
|
|
Warnings:
|
2004-06-15 22:38:36 +02:00
|
|
|
|
Warning 1282 Query cache failed to set size 20480; new query cache size is 0
|
2003-05-31 00:41:11 +02:00
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=40960;
|
2003-10-08 23:13:15 +02:00
|
|
|
|
Warnings:
|
2004-06-15 22:38:36 +02:00
|
|
|
|
Warning 1282 Query cache failed to set size 40960; new query cache size is 0
|
2003-05-31 00:41:11 +02:00
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=51200;
|
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 51200
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=61440;
|
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 61440
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=81920;
|
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 81920
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
set GLOBAL query_cache_size=102400;
|
|
|
|
|
show global variables like "query_cache_size";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
query_cache_size 102400
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
drop table t1;
|
2002-08-07 14:29:49 +02:00
|
|
|
|
set GLOBAL query_cache_size=1048576;
|
|
|
|
|
create table t1 (i int not null);
|
|
|
|
|
create table t2 (i int not null);
|
|
|
|
|
select * from t1;
|
|
|
|
|
i
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
create temporary table t3 (i int not null);
|
|
|
|
|
select * from t2;
|
|
|
|
|
i
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
select * from t3;
|
|
|
|
|
i
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
2002-12-28 20:34:17 +01:00
|
|
|
|
update t1 set i=(select distinct 1 from (select * from t2) a);
|
2002-08-07 14:29:49 +02:00
|
|
|
|
drop table t1, t2, t3;
|
2002-10-07 23:26:15 +02:00
|
|
|
|
use mysql;
|
|
|
|
|
select * from db;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
use test;
|
|
|
|
|
select * from mysql.db;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
2003-01-24 00:54:39 +01:00
|
|
|
|
create table t1(id int auto_increment primary key);
|
|
|
|
|
insert into t1 values (NULL), (NULL), (NULL);
|
|
|
|
|
select * from t1 where id=2;
|
|
|
|
|
id
|
|
|
|
|
2
|
|
|
|
|
alter table t1 rename to t2;
|
|
|
|
|
select * from t1 where id=2;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
2003-01-24 00:54:39 +01:00
|
|
|
|
drop table t2;
|
|
|
|
|
select * from t1 where id=2;
|
2003-06-04 17:28:51 +02:00
|
|
|
|
ERROR 42S02: Table 'test.t1' doesn't exist
|
2003-02-14 21:20:38 +01:00
|
|
|
|
create table t1 (word char(20) not null);
|
|
|
|
|
select * from t1;
|
|
|
|
|
word
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
2007-12-12 18:19:24 +01:00
|
|
|
|
load data infile 'MYSQLTEST_VARDIR/std_data/words.dat' into table t1;
|
2003-02-14 21:20:38 +01:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
2004-02-09 12:31:03 +01:00
|
|
|
|
select count(*) from t1;
|
|
|
|
|
count(*)
|
|
|
|
|
70
|
2003-02-14 21:20:38 +01:00
|
|
|
|
drop table t1;
|
2003-03-06 16:37:12 +01:00
|
|
|
|
create table t1 (a int);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
2004-02-09 12:31:03 +01:00
|
|
|
|
select * from t1 into outfile "query_cache.out.file";
|
|
|
|
|
select * from t1 into outfile "query_cache.out.file";
|
|
|
|
|
ERROR HY000: File 'query_cache.out.file' already exists
|
2003-03-06 16:37:12 +01:00
|
|
|
|
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
drop table t1;
|
2003-03-31 08:49:09 +02:00
|
|
|
|
create table t1 (a int);
|
|
|
|
|
insert into t1 values (1),(2);
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
SET OPTION SQL_SELECT_LIMIT=1;
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
SET OPTION SQL_SELECT_LIMIT=DEFAULT;
|
|
|
|
|
drop table t1;
|
2003-09-15 14:16:13 +02:00
|
|
|
|
flush query cache;
|
|
|
|
|
reset query cache;
|
|
|
|
|
flush status;
|
|
|
|
|
set GLOBAL query_cache_size=1048576;
|
|
|
|
|
create table t1 (a int not null);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
create table t2 (a text not null);
|
|
|
|
|
create table t3 (a text not null);
|
|
|
|
|
insert into t3 values("1111111111111111111111111111111111111111111111111111");
|
|
|
|
|
insert into t2 select * from t3;
|
|
|
|
|
insert into t3 select * from t2;
|
|
|
|
|
insert into t2 select * from t3;
|
|
|
|
|
insert into t3 select * from t2;
|
|
|
|
|
insert into t2 select * from t3;
|
|
|
|
|
insert into t3 select * from t2;
|
|
|
|
|
insert into t2 select * from t3;
|
|
|
|
|
insert into t3 select * from t2;
|
|
|
|
|
insert into t2 select * from t3;
|
|
|
|
|
insert into t3 select * from t2;
|
|
|
|
|
drop table t2;
|
|
|
|
|
create table t2 (a int not null);
|
|
|
|
|
insert into t2 values (1),(2),(3);
|
|
|
|
|
create table t4 (a int not null);
|
|
|
|
|
insert into t4 values (1),(2),(3);
|
|
|
|
|
select * from t4;
|
|
|
|
|
select * from t2;
|
|
|
|
|
select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
|
|
|
|
|
select * from t2;
|
|
|
|
|
select * from t4;
|
|
|
|
|
select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
|
|
|
|
|
select * from t2;
|
|
|
|
|
select * from t4;
|
|
|
|
|
select * from t1 as tt, t1 as ttt where tt.a=1 and ttt.a=2;
|
|
|
|
|
delete from t2 where a=1;
|
|
|
|
|
flush query cache;
|
|
|
|
|
select * from t3;
|
|
|
|
|
delete from t4 where a=1;
|
|
|
|
|
flush query cache;
|
|
|
|
|
drop table t1,t2,t3,t4;
|
2004-03-17 23:09:13 +01:00
|
|
|
|
set query_cache_wlock_invalidate=1;
|
|
|
|
|
create table t1 (a int not null);
|
|
|
|
|
create table t2 (a int not null);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
select * from t2;
|
|
|
|
|
a
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
lock table t1 write, t2 read;
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
unlock table;
|
|
|
|
|
drop table t1,t2;
|
|
|
|
|
set query_cache_wlock_invalidate=default;
|
2004-10-21 22:56:12 +02:00
|
|
|
|
CREATE TABLE t1 (id INT PRIMARY KEY);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
select * from t1;
|
|
|
|
|
id
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
create temporary table t1 (a int not null auto_increment
|
|
|
|
|
primary key);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
drop table t1;
|
|
|
|
|
drop table t1;
|
2003-10-08 07:18:38 +02:00
|
|
|
|
SET NAMES koi8r;
|
|
|
|
|
CREATE TABLE t1 (a char(1) character set koi8r);
|
|
|
|
|
INSERT INTO t1 VALUES (_koi8r'<27>'),(_koi8r'<27>');
|
|
|
|
|
SELECT a,'<27>','<27>'='<27>' FROM t1;
|
|
|
|
|
a <09> '<27>'='<27>'
|
|
|
|
|
<EFBFBD> <09> 1
|
|
|
|
|
<EFBFBD> <09> 1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-11-04 13:09:03 +01:00
|
|
|
|
Qcache_hits 6
|
2003-10-08 07:18:38 +02:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
set collation_connection=koi8r_bin;
|
|
|
|
|
SELECT a,'<27>','<27>'='<27>' FROM t1;
|
|
|
|
|
a <09> '<27>'='<27>'
|
|
|
|
|
<EFBFBD> <09> 0
|
|
|
|
|
<EFBFBD> <09> 0
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-11-04 13:09:03 +01:00
|
|
|
|
Qcache_hits 6
|
2003-10-08 07:18:38 +02:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
set character_set_client=cp1251;
|
|
|
|
|
SELECT a,'<27>','<27>'='<27>' FROM t1;
|
|
|
|
|
a <09> '<27>'='<27>'
|
|
|
|
|
<EFBFBD> <09> 0
|
|
|
|
|
<EFBFBD> <09> 0
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-11-04 13:09:03 +01:00
|
|
|
|
Qcache_hits 6
|
2003-10-08 07:18:38 +02:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 3
|
|
|
|
|
set character_set_results=cp1251;
|
|
|
|
|
SELECT a,'<27>','<27>'='<27>' FROM t1;
|
|
|
|
|
a <09> '<27>'='<27>'
|
|
|
|
|
<EFBFBD> <09> 0
|
|
|
|
|
<EFBFBD> <09> 0
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-11-04 13:09:03 +01:00
|
|
|
|
Qcache_hits 6
|
2003-10-08 07:18:38 +02:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 4
|
2005-07-23 06:51:25 +02:00
|
|
|
|
SET NAMES default;
|
2003-10-08 07:18:38 +02:00
|
|
|
|
DROP TABLE t1;
|
2003-12-04 22:57:10 +01:00
|
|
|
|
CREATE TABLE t1 (a int(1));
|
|
|
|
|
CREATE DATABASE mysqltest;
|
|
|
|
|
USE mysqltest;
|
|
|
|
|
DROP DATABASE mysqltest;
|
|
|
|
|
SELECT * FROM test.t1;
|
|
|
|
|
a
|
|
|
|
|
USE test;
|
2004-02-11 18:21:55 +01:00
|
|
|
|
DROP TABLE t1;
|
2004-03-30 22:38:56 +02:00
|
|
|
|
set character_set_results=null;
|
|
|
|
|
select @@character_set_results;
|
|
|
|
|
@@character_set_results
|
|
|
|
|
NULL
|
|
|
|
|
set character_set_results=default;
|
2004-09-10 15:28:18 +02:00
|
|
|
|
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
|
2004-10-10 09:10:53 +02:00
|
|
|
|
Warnings:
|
|
|
|
|
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
|
2004-09-10 15:28:18 +02:00
|
|
|
|
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;
|
2003-07-18 15:34:50 +02:00
|
|
|
|
create table t1 (a int);
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
2005-07-05 11:23:13 +02:00
|
|
|
|
Qcache_inserts 18
|
2003-07-18 15:34:50 +02:00
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2003-11-19 16:59:35 +01:00
|
|
|
|
Qcache_hits 6
|
2003-07-18 15:34:50 +02:00
|
|
|
|
/**/ select * from t1;
|
|
|
|
|
a
|
|
|
|
|
/**/ select * from t1;
|
|
|
|
|
a
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_queries_in_cache 1
|
2003-07-18 15:34:50 +02:00
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_inserts 19
|
2003-07-18 15:34:50 +02:00
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_hits 7
|
2003-11-19 16:59:35 +01:00
|
|
|
|
DROP TABLE t1;
|
2003-11-04 13:09:03 +01:00
|
|
|
|
SET GLOBAL query_cache_size=0;
|
wl#1629 SHOW with WHERE(final part, after review)
added syntax:
'show variables where', 'show status where', 'show open tables where'
mysql-test/r/grant_cache.result:
wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/information_schema.result:
wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/query_cache.result:
wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/temp_table.result:
wl#1629 SHOW with WHERE(final part,after review)
mysql-test/r/union.result:
wl#1629 SHOW with WHERE(final part,after review)
mysql-test/t/information_schema.test:
wl#1629 SHOW with WHERE(final part,after review)
mysql-test/t/query_cache.test:
wl#1629 SHOW with WHERE(final part,after review)
sql/item.cc:
wl#1629 SHOW with WHERE(final part,after review)
sql/mysql_priv.h:
wl#1629 SHOW with WHERE(final part,after review)
sql/sql_parse.cc:
wl#1629 SHOW with WHERE(final part,after review)
sql/sql_select.cc:
wl#1629 SHOW with WHERE(final part,after review)
sql/sql_show.cc:
wl#1629 SHOW with WHERE(final part,after review)
sql/sql_yacc.yy:
wl#1629 SHOW with WHERE(final part,after review)
sql/table.h:
wl#1629 SHOW with WHERE(final part,after review)
2004-12-30 13:20:40 +01:00
|
|
|
|
SET SESSION query_cache_type = 2;
|
|
|
|
|
create table t1(a int);
|
|
|
|
|
select table_name from information_schema.tables
|
|
|
|
|
where table_schema="test";
|
|
|
|
|
table_name
|
|
|
|
|
t1
|
|
|
|
|
drop table t1;
|
|
|
|
|
select table_name from information_schema.tables
|
|
|
|
|
where table_schema="test";
|
|
|
|
|
table_name
|
2005-03-12 00:06:03 +01:00
|
|
|
|
SET SESSION query_cache_type = 1;
|
2005-03-08 03:15:19 +01:00
|
|
|
|
set global query_cache_size=1024*1024;
|
|
|
|
|
flush query cache;
|
|
|
|
|
create table t1 ( a int );
|
|
|
|
|
insert into t1 values (1);
|
|
|
|
|
select a from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
select a from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
show status like 'qcache_queries_in_cache';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
repair table t1;
|
|
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
|
test.t1 repair status OK
|
|
|
|
|
show status like 'qcache_queries_in_cache';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
drop table t1;
|
2005-04-01 05:17:45 +02:00
|
|
|
|
set GLOBAL query_cache_size=64*1024;
|
|
|
|
|
create table t1 (a text);
|
|
|
|
|
insert into t1 values (repeat('abcdefghijklmnopqrstuvwxyz', 550));
|
|
|
|
|
create table t2 (a text);
|
|
|
|
|
insert into t2 values (repeat('ijklmnopqrstuvwxyzabcdefgh', 550));
|
|
|
|
|
select a from t1;
|
|
|
|
|
select a from t2;
|
|
|
|
|
show status like 'Qcache_%_blocks';
|
2005-05-02 20:45:06 +02:00
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_free_blocks 1
|
|
|
|
|
Qcache_total_blocks 7
|
2005-04-01 05:17:45 +02:00
|
|
|
|
insert into t1 select reverse(a) from t1;
|
|
|
|
|
show status like 'Qcache_%_blocks';
|
2005-05-02 20:45:06 +02:00
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_free_blocks 2
|
|
|
|
|
Qcache_total_blocks 5
|
2005-04-01 05:17:45 +02:00
|
|
|
|
select a from t1;
|
|
|
|
|
show status like 'Qcache_%_blocks';
|
2005-05-02 20:45:06 +02:00
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_free_blocks 1
|
|
|
|
|
Qcache_total_blocks 8
|
2005-04-01 05:17:45 +02:00
|
|
|
|
select a from t1;
|
|
|
|
|
a
|
|
|
|
|
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklm
|
|
|
|
|
zyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqponmlkjihgfedcbazyxwvutsrqpon
|
|
|
|
|
flush query cache;
|
|
|
|
|
drop table t1, t2;
|
2006-07-29 12:35:30 +02:00
|
|
|
|
set GLOBAL query_cache_size=1355776;
|
2005-07-05 11:23:13 +02:00
|
|
|
|
flush status;
|
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
|
`date` datetime NOT NULL default '0000-00-00 00:00:00',
|
|
|
|
|
KEY `date` (`date`)
|
|
|
|
|
) ENGINE=MyISAM;
|
|
|
|
|
INSERT INTO t1 VALUES ('20050326');
|
|
|
|
|
INSERT INTO t1 VALUES ('20050325');
|
2005-08-04 21:45:32 +02:00
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
|
2005-07-05 11:23:13 +02:00
|
|
|
|
COUNT(*)
|
|
|
|
|
0
|
|
|
|
|
Warnings:
|
2011-06-06 20:28:15 +02:00
|
|
|
|
Warning 1292 Incorrect datetime value: '20050327 invalid'
|
2005-08-04 21:45:32 +02:00
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid';
|
2005-07-05 11:23:13 +02:00
|
|
|
|
COUNT(*)
|
|
|
|
|
0
|
|
|
|
|
Warnings:
|
2011-06-06 20:28:15 +02:00
|
|
|
|
Warning 1292 Incorrect datetime value: '20050328 invalid'
|
2005-08-04 21:45:32 +02:00
|
|
|
|
SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid';
|
2005-07-05 11:23:13 +02:00
|
|
|
|
COUNT(*)
|
|
|
|
|
0
|
|
|
|
|
Warnings:
|
2011-06-06 20:28:15 +02:00
|
|
|
|
Warning 1292 Incorrect datetime value: '20050327 invalid'
|
2005-07-05 11:23:13 +02:00
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 0
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 0
|
|
|
|
|
drop table t1;
|
|
|
|
|
create table t1 (a int);
|
|
|
|
|
insert into t1 values (1);
|
|
|
|
|
reset query cache;
|
|
|
|
|
flush status;
|
|
|
|
|
select * from (select * from t1) a;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 0
|
|
|
|
|
select * from (select * from t1) a;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 1
|
|
|
|
|
insert into t1 values (2);
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 1
|
|
|
|
|
select * from (select * from t1) a;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 2
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 1
|
|
|
|
|
drop table t1;
|
2005-06-14 21:45:48 +02:00
|
|
|
|
create table t1 (a int);
|
2005-12-02 19:05:23 +01:00
|
|
|
|
flush status;
|
|
|
|
|
(select a from t1) union (select a from t1);
|
|
|
|
|
a
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_queries_in_cache 1
|
2005-12-02 19:05:23 +01:00
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_inserts 1
|
2005-12-02 19:05:23 +01:00
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 0
|
|
|
|
|
(select a from t1) union (select a from t1);
|
|
|
|
|
a
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_queries_in_cache 1
|
2005-12-02 19:05:23 +01:00
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_inserts 1
|
2005-12-02 19:05:23 +01:00
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
2011-12-13 13:00:20 +01:00
|
|
|
|
Qcache_hits 1
|
|
|
|
|
set global query_cache_strip_comments=1;
|
|
|
|
|
(select a from t1) union (select a from t1);
|
|
|
|
|
a
|
|
|
|
|
(select a from t1) /* */union (select a from t1);
|
|
|
|
|
a
|
|
|
|
|
set global query_cache_strip_comments=0;
|
|
|
|
|
(select a from t1) union (select a from t1);
|
|
|
|
|
a
|
|
|
|
|
show status like "Qcache_queries_in_cache";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 1
|
|
|
|
|
show status like "Qcache_inserts";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_inserts 1
|
|
|
|
|
show status like "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 4
|
2005-12-02 19:05:23 +01:00
|
|
|
|
drop table t1;
|
|
|
|
|
create table t1 (a int);
|
2005-06-14 21:45:48 +02:00
|
|
|
|
insert into t1 values (1),(2);
|
2006-06-20 12:20:32 +02:00
|
|
|
|
drop procedure if exists p1;
|
2005-06-14 21:45:48 +02:00
|
|
|
|
CREATE PROCEDURE `p1`()
|
|
|
|
|
begin
|
|
|
|
|
Declare c1 cursor for select a from t1;
|
|
|
|
|
open c1;
|
|
|
|
|
select * from t1;
|
|
|
|
|
end//
|
|
|
|
|
call p1()//
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
drop procedure p1;
|
|
|
|
|
create function f1() returns int
|
|
|
|
|
begin
|
|
|
|
|
Declare var1 int;
|
|
|
|
|
select max(a) from t1 into var1;
|
|
|
|
|
return var1;
|
|
|
|
|
end//
|
|
|
|
|
create procedure `p1`()
|
|
|
|
|
begin
|
|
|
|
|
select a, f1() from t1;
|
|
|
|
|
end//
|
BUG#37975: wait_for_slave_* should increase the timeout
Problem 1: tests often fail in pushbuild with a timeout when waiting
for the slave to start/stop/receive error.
Fix 1: Updated the wait_for_slave_* macros in the following way:
- The timeout is increased by a factor ten
- Refactored the macros so that wait_for_slave_param does the work for
the other macros.
Problem 2: Tests are often incorrectly written, lacking a
source include/wait_for_slave_to_[start|stop].inc.
Fix 2: Improved the chance to get it right by adding
include/start_slave.inc and include/stop_slave.inc, and updated tests
to use these.
Problem 3: The the built-in test language command
wait_for_slave_to_stop is a misnomer (does not wait for the slave io
thread) and does not give as much debug info in case of failure as
the otherwise equivalent macro
source include/wait_for_slave_sql_to_stop.inc
Fix 3: Replaced all calls to the built-in command by a call to the
macro.
Problem 4: Some, but not all, of the wait_for_slave_* macros had an
implicit connection slave. This made some tests confusing to read,
and made it more difficult to use the macro in circular replication
scenarios, where the connection named master needs to wait.
Fix 4: Removed the implicit connection slave from all
wait_for_slave_* macros, and updated tests to use an explicit
connection slave where necessary.
Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc
were unused. Moreover, using them is difficult and error-prone.
Fix 5: remove these macros.
Problem 6: log_bin_trust_function_creators_basic failed when running
tests because it assumed @@global.log_bin_trust_function_creators=1,
and some tests modified this variable without resetting it to its
original value.
Fix 6: All tests that use this variable have been updated so that
they reset the value at end of test.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
Added connection slave since includ/wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/extra/rpl_tests/rpl_log.test:
Replaced start slave+wait_slave_status by start_slave.inc
mysql-test/include/reset_master_and_slave.inc:
replaced start/stop slave by start_slave.inc/stop_slave.inc
mysql-test/include/sync_slave_io_with_master.inc:
Improved comments and error message.
mysql-test/include/wait_for_slave_io_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_param.inc:
- Improved usage instructions
- Added more debug info in case of timeout
- Added parameters $slave_param_comparison, $slave_timeout,
$slave_keep_connection, $slave_error_message
mysql-test/include/wait_for_slave_sql_error.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_show_pattern.inc:
Removed unused (and error-prone) file
mysql-test/include/wait_slave_status.inc:
Removed unused (and error-prone) file
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_bug26395.test:
Replace stop slave by stop_slave.inc
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test:
Replace start/stop slave by start_slave.inc/stop_slave.inc.
Replace wait_for_slave_param by wait_for_slave_sql_to_stop.inc.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
Replace wait_slave_status by start_slave.inc
mysql-test/suite/rpl/t/rpl_idempotency.test:
Added connection slave since wait_for_slave_sql_to_stop.inc does not
do that any more.
mysql-test/suite/rpl/t/rpl_incident.test:
Replaced wait_for_slave_to_stop by wait_for_slave_sql_to_stop.inc
mysql-test/suite/rpl/t/rpl_init_slave.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_log_pos.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced wait_for_slave_param by other wait_for_slave_* macros.
mysql-test/suite/rpl/t/rpl_packet.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_server_id1.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_status.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_sp.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_sp_effects.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_stm_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
Replaced start slave by start_slave.inc.
Added explicit connection slave since wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/t/disabled.def:
Disabled failing test.
mysql-test/t/func_time.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/innodb_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/log_bin_trust_function_creators_func.test:
Restore @@global.log_bin_trust_function_creators at end of test.
Clean up at end of test by dropping the created user.
mysql-test/t/query_cache.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/query_cache_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/rpl_init_slave_func.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/t/timezone2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
2008-07-10 18:09:39 +02:00
|
|
|
|
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
|
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Fix tests for new behaviour: an error is thrown if a NON DETERMINISTIC
stored function (SF) is called during statement-based replication (SBR).
mysql-test/r/func_time.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/gis.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/grant2.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/innodb_notembedded.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/ps.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/query_cache.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/query_cache_notembedded.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/rpl_sp.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Move test for SF-calls in different replication modes to its own file, rpl_sf.
mysql-test/r/rpl_sp_effects.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/r/sp.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/r/timezone2.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/func_time.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/gis.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/t/grant2.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/innodb_notembedded.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/ps.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/query_cache.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/query_cache_notembedded.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/rpl_sp.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/rpl_sp_effects.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
mysql-test/t/sp.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Mark function as DETERMINISTIC so it can be called with no error while
doing statement-based replication (SBR).
mysql-test/t/timezone2.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Modify test that contains non-deterministic functions so it can still be
called with no error while doing statement-based replication (SBR).
sql/item_func.cc:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
If 'log_bin_trust_function_creators' variable is set, don't throw an error
on calling a non-deterministc function in statement-based replication (SBR).
sql/sql_parse.cc:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Do not throw an error on calling a NON DETERMINISTIC stored procedure (SP)
while doing statement-based replication (SBR), as the routine body is
executed statement-by-statement.
mysql-test/r/rpl_sf.result:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Test for stored function (SF) calls in different replication modes.
NON DETERMINISTIC SFs are not allowed while doing
statement-based replication (SBR).
mysql-test/t/rpl_sf.test:
Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
Test for stored function (SF) calls in different replication modes.
NON DETERMINISTIC SFs are not allowed while doing
statement-based replication (SBR).
2006-11-17 21:30:28 +01:00
|
|
|
|
SET GLOBAL log_bin_trust_function_creators = 1;
|
2005-06-14 21:45:48 +02:00
|
|
|
|
call p1()//
|
|
|
|
|
a f1()
|
|
|
|
|
1 2
|
|
|
|
|
2 2
|
BUG#37975: wait_for_slave_* should increase the timeout
Problem 1: tests often fail in pushbuild with a timeout when waiting
for the slave to start/stop/receive error.
Fix 1: Updated the wait_for_slave_* macros in the following way:
- The timeout is increased by a factor ten
- Refactored the macros so that wait_for_slave_param does the work for
the other macros.
Problem 2: Tests are often incorrectly written, lacking a
source include/wait_for_slave_to_[start|stop].inc.
Fix 2: Improved the chance to get it right by adding
include/start_slave.inc and include/stop_slave.inc, and updated tests
to use these.
Problem 3: The the built-in test language command
wait_for_slave_to_stop is a misnomer (does not wait for the slave io
thread) and does not give as much debug info in case of failure as
the otherwise equivalent macro
source include/wait_for_slave_sql_to_stop.inc
Fix 3: Replaced all calls to the built-in command by a call to the
macro.
Problem 4: Some, but not all, of the wait_for_slave_* macros had an
implicit connection slave. This made some tests confusing to read,
and made it more difficult to use the macro in circular replication
scenarios, where the connection named master needs to wait.
Fix 4: Removed the implicit connection slave from all
wait_for_slave_* macros, and updated tests to use an explicit
connection slave where necessary.
Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc
were unused. Moreover, using them is difficult and error-prone.
Fix 5: remove these macros.
Problem 6: log_bin_trust_function_creators_basic failed when running
tests because it assumed @@global.log_bin_trust_function_creators=1,
and some tests modified this variable without resetting it to its
original value.
Fix 6: All tests that use this variable have been updated so that
they reset the value at end of test.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Replaced wait_for_slave_to_stop by include/wait_for_slave_sql_to_stop.inc
Added connection slave since includ/wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/extra/rpl_tests/rpl_log.test:
Replaced start slave+wait_slave_status by start_slave.inc
mysql-test/include/reset_master_and_slave.inc:
replaced start/stop slave by start_slave.inc/stop_slave.inc
mysql-test/include/sync_slave_io_with_master.inc:
Improved comments and error message.
mysql-test/include/wait_for_slave_io_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_param.inc:
- Improved usage instructions
- Added more debug info in case of timeout
- Added parameters $slave_param_comparison, $slave_timeout,
$slave_keep_connection, $slave_error_message
mysql-test/include/wait_for_slave_sql_error.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_sql_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_start.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_for_slave_to_stop.inc:
Refactored to use wait_for_slave_param.inc.
Removed connection slave.
mysql-test/include/wait_show_pattern.inc:
Removed unused (and error-prone) file
mysql-test/include/wait_slave_status.inc:
Removed unused (and error-prone) file
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_bug26395.test:
Replace stop slave by stop_slave.inc
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test:
Replace start/stop slave by start_slave.inc/stop_slave.inc.
Replace wait_for_slave_param by wait_for_slave_sql_to_stop.inc.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Renamed $keep_connection to $slave_keep_connection.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
Replace wait_slave_status by start_slave.inc
mysql-test/suite/rpl/t/rpl_idempotency.test:
Added connection slave since wait_for_slave_sql_to_stop.inc does not
do that any more.
mysql-test/suite/rpl/t/rpl_incident.test:
Replaced wait_for_slave_to_stop by wait_for_slave_sql_to_stop.inc
mysql-test/suite/rpl/t/rpl_init_slave.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_log_pos.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced wait_for_slave_param by other wait_for_slave_* macros.
mysql-test/suite/rpl/t/rpl_packet.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_row_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_server_id1.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_slave_status.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/suite/rpl/t/rpl_sp.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_sp_effects.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/suite/rpl/t/rpl_stm_until.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
Replaced save_master_pos;connection slave;sync_with_master by
sync_slave_with_master.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
Replaced start slave by start_slave.inc.
Added explicit connection slave since wait_for_slave_sql_to_stop.inc
does not do that anymore.
mysql-test/t/disabled.def:
Disabled failing test.
mysql-test/t/func_time.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/grant2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/innodb_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/log_bin_trust_function_creators_func.test:
Restore @@global.log_bin_trust_function_creators at end of test.
Clean up at end of test by dropping the created user.
mysql-test/t/query_cache.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/query_cache_notembedded.test:
Restore @@global.log_bin_trust_function_creators at end of test.
mysql-test/t/rpl_init_slave_func.test:
Replaced start/stop slave by start_slave.inc/stop_slave.inc.
mysql-test/t/timezone2.test:
Restore @@global.log_bin_trust_function_creators at end of test.
2008-07-10 18:09:39 +02:00
|
|
|
|
SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
|
2005-06-14 21:45:48 +02:00
|
|
|
|
drop procedure p1//
|
Add new option "check-testcases" to mysql-test-run.pl
Cleanup the sideeffects from most of the testcases with sideeffects.
mysql-test/mysql-test-run.pl:
Add option "check-testcases" to mysql-test-run.pl
Will execute "include/check-testcase.test" once before each tescase and record the output into "var/tmp/check-testcase.result"
After the teastcase it will run again and this time compare the output with previously recorded file.
mysql-test/r/analyze.result:
Drop table t1 at end of test
mysql-test/r/create_select_tmp.result:
Drop table t1 at end of test
mysql-test/r/ctype_cp932.result:
Drop table t1 at end of test
mysql-test/r/ctype_recoding.result:
Drop table t1 at end of test
mysql-test/r/grant2.result:
Drop user mysqltest_2 and mysqltest_A@'%'
mysql-test/r/join_outer.result:
Drop view v1 to cleanup
mysql-test/r/ps_1general.result:
Drop table t1 at end of test
mysql-test/r/query_cache.result:
Drop function "f1"
mysql-test/r/read_only.result:
Reset the "read_only" flag
mysql-test/r/rpl000001.result:
Remove user "blafasel2"
mysql-test/r/rpl000017.result:
Remove user "replicate"
mysql-test/r/rpl_failed_optimize.result:
Drop table t1 to cleanup
mysql-test/r/rpl_flush_tables.result:
Drop tables t3, t4, t5
mysql-test/r/rpl_ignore_revoke.result:
Delete user "user_foo"
mysql-test/r/rpl_insert_id.result:
Drop table t1 to cleanup
mysql-test/r/rpl_loaddata.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_loaddata_rule_m.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_loaddata_rule_s.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_misc_functions.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_multi_update3.result:
Drop tyable t1 and t2 to cleanup
mysql-test/r/rpl_replicate_do.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_skip_error.result:
Drop tyable t1 to cleanup
mysql-test/r/rpl_slave_status.result:
Drop tyable t1 to cleanup
mysql-test/r/sp-prelocking.result:
Drop view v1 and tables t1, t2, t3 and t4 to cleanup
mysql-test/r/sp-security.result:
Delete users to cleanup
Delete remaining traces in tables_priv and procs_priv
mysql-test/r/subselect_innodb.result:
Drop procedure p1 to cleanup
mysql-test/r/trigger-compat.result:
Drop trigger wl2818_trg1 and wl2818_trg2.
Drop table t1, t2
Drop database mysqltest_db1
And the users "mysqltest_dfn@localhost" and "mysqltest_inv@localhost"
mysql-test/r/type_bit.result:
Drop tables t1 and t2 to cleanup
mysql-test/r/variables.result:
Set GLOBAL max_join_size to 10 as it originally was in variables-master.opt
mysql-test/r/view_grant.result:
Dop user "test@localhost" to cleanup
mysql-test/t/analyze.test:
Drop table t1 to cleanup
mysql-test/t/create_select_tmp.test:
Drop table t1 to cleanup
mysql-test/t/ctype_cp932.test:
Drop table t1 to cleanup
mysql-test/t/ctype_recoding.test:
Drop table t1 to cleanup
mysql-test/t/fulltext_var.test:
Restore the original ft_boolean_syntax
mysql-test/t/grant2.test:
Drop users "mysqltest_2" and "mysqltest_A@'%'" to cleanup
mysql-test/t/innodb_cache.test:
Reset query_cache_size to original value
mysql-test/t/join_outer.test:
Drop view v1 to cleanup
mysql-test/t/ps_1general.test:
Drop table t1 to cleanup
mysql-test/t/query_cache.test:
Drop function "f1" to cleanup
mysql-test/t/read_only.test:
Reset the readonly flag
mysql-test/t/rpl000001.test:
Delete user "blafasel2" to cleanup
mysql-test/t/rpl000017.test:
Delete user "replicate" to cleanup
mysql-test/t/rpl_failed_optimize.test:
Drop table t1 to cleanup
mysql-test/t/rpl_flush_tables.test:
Droip table t3, t4 and t5 to cleanup
mysql-test/t/rpl_ignore_revoke.test:
Delet user "user_foo" to cleanup
mysql-test/t/rpl_insert_id.test:
drop table t1 to cleanup
mysql-test/t/rpl_loaddata.test:
Drop table t1 to cleanup
mysql-test/t/rpl_loaddata_rule_m.test:
Drop table t1 to cleanup
mysql-test/t/rpl_loaddata_rule_s.test:
Drop table t1 to cleanup
mysql-test/t/rpl_misc_functions.test:
Drop table t1 to cleanup
mysql-test/t/rpl_multi_update3.test:
Drop table t1 and t2 to cleanup
mysql-test/t/rpl_replicate_do.test:
Drop table t1 to cleanup
mysql-test/t/rpl_skip_error.test:
Drop table t1 to cleanup
mysql-test/t/rpl_slave_status.test:
Drop table t1 to cleanup
mysql-test/t/sp-prelocking.test:
Drop table t1, t2 t3 and t4 to cleanup
Drop view v1
mysql-test/t/sp-security.test:
Delete test users from mysql.user, mysql.db, mysql.procs_priv and mysql.tables_priv
Drop table t1 to cleanup
mysql-test/t/subselect_innodb.test:
Drop procedure p1 to cleanup
mysql-test/t/trigger-compat.test:
Drop trigger wl2818_trg1 and wl2818_trg2 to cleanup
Drop table t1, t2
Drop users
drop database mysqltest_db1
mysql-test/t/type_bit.test:
drop table t1 and t2 to cleanup
mysql-test/t/variables-master.opt:
Increase max_join_size to 100.
mysql-test/t/variables.test:
Set max_join_size to 10, which was the original value in variables-master.opt
mysql-test/t/view_grant.test:
Drop the user "test@localhost"
mysql-test/include/check-testcase.test:
New BitKeeper file ``mysql-test/include/check-testcase.test''
2006-01-26 17:54:34 +01:00
|
|
|
|
drop function f1//
|
2005-06-14 21:45:48 +02:00
|
|
|
|
drop table t1//
|
2005-07-23 06:51:25 +02:00
|
|
|
|
flush query cache;
|
|
|
|
|
reset query cache;
|
|
|
|
|
flush status;
|
|
|
|
|
create table t1 (s1 int)//
|
|
|
|
|
create procedure f1 () begin
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
select sql_cache * from t1;
|
2005-09-29 10:25:44 +02:00
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
end;//
|
|
|
|
|
create procedure f2 () begin
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
end;//
|
|
|
|
|
create procedure f3 () begin
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
end;//
|
|
|
|
|
create procedure f4 () begin
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
2005-07-23 06:51:25 +02:00
|
|
|
|
end;//
|
|
|
|
|
call f1();
|
|
|
|
|
s1
|
2005-09-29 10:25:44 +02:00
|
|
|
|
s1
|
|
|
|
|
s1
|
2005-07-23 06:51:25 +02:00
|
|
|
|
call f1();
|
|
|
|
|
s1
|
2005-09-29 10:25:44 +02:00
|
|
|
|
s1
|
|
|
|
|
s1
|
2005-07-23 06:51:25 +02:00
|
|
|
|
call f1();
|
|
|
|
|
s1
|
2005-09-29 10:25:44 +02:00
|
|
|
|
s1
|
|
|
|
|
s1
|
2005-07-23 06:51:25 +02:00
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
s1
|
|
|
|
|
insert into t1 values (1);
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f1();
|
|
|
|
|
s1
|
|
|
|
|
1
|
2005-09-29 10:25:44 +02:00
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
2005-07-23 06:51:25 +02:00
|
|
|
|
call f1();
|
|
|
|
|
s1
|
|
|
|
|
1
|
2005-09-29 10:25:44 +02:00
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
2005-07-23 06:51:25 +02:00
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
2005-09-29 10:25:44 +02:00
|
|
|
|
flush query cache;
|
|
|
|
|
reset query cache;
|
|
|
|
|
flush status;
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f1();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f2();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f3();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f4();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f4();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f3();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f2();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
insert into t1 values (2);
|
|
|
|
|
call f1();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
select sql_cache * from t1 where s1=1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
select sql_cache * from t1;
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
call f1();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
call f3();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f3();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
call f1();
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
s1
|
|
|
|
|
1
|
|
|
|
|
2
|
2005-07-23 06:51:25 +02:00
|
|
|
|
drop procedure f1;
|
2005-09-29 10:25:44 +02:00
|
|
|
|
drop procedure f2;
|
|
|
|
|
drop procedure f3;
|
|
|
|
|
drop procedure f4;
|
2005-07-23 06:51:25 +02:00
|
|
|
|
drop table t1;
|
2003-09-15 14:16:13 +02:00
|
|
|
|
set GLOBAL query_cache_size=0;
|
Fix multiple test suite failures in Buildbot due to races in the test cases or missing server features not properly checked
mysql-test/r/func_misc.result:
Move test that requires query cache from main.func_misc to main.query_cache.
mysql-test/r/mysqltest.result:
Fix test failure due to race.
This test case creates > 300 connections in a tight loop, and depending on thread
scheduling and load, even though each connection is immediately disconnected
before connecting the next one, the server max connections may still be exceeded
due to server not being able to free old connections as fast as new ones are made.
mysql-test/r/query_cache.result:
Move test that requires query cache from main.func_misc to main.query_cache.
Move test that requires query cache from main.variables to main.query_cache.
mysql-test/r/query_cache_notembedded.result:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/r/sp_notembedded.result:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/r/udf.result:
Move test in main.udf that requires query cache to separate file.
mysql-test/r/udf_query_cache.result:
Move test in main.udf that requires query cache to separate file.
mysql-test/r/variables.result:
Move test that requires query cache from main.variables to main.query_cache.
mysql-test/suite/funcs_1/datadict/processlist_val.inc:
Fix race where result file may show state "cleaning up" in the small window
between setting COMMAND to 'Sleep' and clearing STATE.
mysql-test/suite/rpl/r/rpl_temporary.result:
Fix race with suppression of warning message by fixing the test to not generate the
warning message in the first place.
Problem was a race between creating an anonymous account and resetting the slave.
If the slave reset happens before replicating the account, the subsequest deletion
of the account will fail to replicate correctly due to missing row.
mysql-test/suite/rpl/t/rpl_temporary.test:
Fix race with suppression of warning message by fixing the test to not generate the
warning message in the first place.
Problem was a race between creating an anonymous account and resetting the slave.
If the slave reset happens before replicating the account, the subsequest deletion
of the account will fail to replicate correctly due to missing row.
mysql-test/t/func_misc.test:
Move test that requires query cache from main.func_misc to main.query_cache.
Move test that requires query cache from main.variables to main.query_cache.
mysql-test/t/mysqltest.test:
Fix test failure due to race.
This test case creates > 300 connections in a tight loop, and depending on thread
scheduling and load, even though each connection is immediately disconnected
before connecting the next one, the server max connections may still be exceeded
due to server not being able to free old connections as fast as new ones are made.
mysql-test/t/query_cache.test:
Move test that requires query cache to main.query_cache.
mysql-test/t/query_cache_notembedded.test:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/t/sp_notembedded.test:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/t/udf.test:
Move test in main.udf that requires query cache to separate file.
mysql-test/t/udf_query_cache-master.opt:
Move test in main.udf that requires query cache to separate file.
mysql-test/t/udf_query_cache.test:
Move test in main.udf that requires query cache to separate file.
mysql-test/t/variables.test:
Move test that requires query cache from main.variables to main.query_cache.
tests/mysql_client_test.c:
In tests that require query cache, skip the test if query cache not available.
Do this dynamically rather than using HAVE_QUERY_CACHE, as there is no guarantee
that the server we run against was compiled with same preprocessor #define as
the mysql_client_test program (and since it is trivial to check dynamically).
2010-01-11 14:15:28 +01:00
|
|
|
|
set GLOBAL query_cache_size=100000;
|
|
|
|
|
set SESSION query_cache_size=10000;
|
|
|
|
|
ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
|
|
|
|
|
set global query_cache_limit=100;
|
|
|
|
|
set global query_cache_size=100;
|
|
|
|
|
set global query_cache_type=demand;
|
|
|
|
|
set GLOBAL query_cache_type=default;
|
|
|
|
|
set GLOBAL query_cache_limit=default;
|
|
|
|
|
set GLOBAL query_cache_size=default;
|
2007-07-16 22:59:21 +02:00
|
|
|
|
End of 4.1 tests
|
2005-09-06 12:00:35 +02:00
|
|
|
|
SET GLOBAL query_cache_size=102400;
|
|
|
|
|
create table t1(a int);
|
|
|
|
|
insert into t1 values(0), (1), (4), (5);
|
|
|
|
|
select * from t1 where a > 3;
|
|
|
|
|
a
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
select * from t1 where a > 3;
|
|
|
|
|
a
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
show status like 'last_query_cost';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Last_query_cost 0.000000
|
|
|
|
|
drop table t1;
|
|
|
|
|
SET GLOBAL query_cache_size=0;
|
2006-11-14 17:50:44 +01:00
|
|
|
|
set global query_cache_size=1024*1024;
|
|
|
|
|
flush status;
|
|
|
|
|
create table t1 (a int);
|
|
|
|
|
insert into t1 (a) values (1), (2), (3);
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like 'Qcache_hits';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 0
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like 'Qcache_hits';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 1
|
|
|
|
|
create table t2 like t1;
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like 'Qcache_hits';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 2
|
|
|
|
|
insert into t2 select * from t1;
|
|
|
|
|
select * from t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
show status like 'Qcache_hits';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 3
|
|
|
|
|
drop table t1, t2;
|
|
|
|
|
create table t1(c1 int);
|
|
|
|
|
create table t2(c1 int);
|
|
|
|
|
create table t3(c1 int);
|
|
|
|
|
create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
|
|
|
|
|
start transaction;
|
|
|
|
|
insert into t1(c1) select c1 from v1;
|
|
|
|
|
drop table t1, t2, t3;
|
|
|
|
|
drop view v1;
|
Fix for BUG#735 "Prepared Statements: there is no support for Query
Cache".
WL#1569 "Prepared Statements: implement support of Query Cache".
Prepared SELECTs did not look up in the query cache, and their results
were not stored in the query cache. This made them slower than
non-prepared SELECTs in some cases.
The fix is to re-use the expanded query (the prepared query where
"?" placeholders are replaced by their values, at execution time)
for searching/storing in the query cache.
It works fine for statements prepared via mysql_stmt_prepare(), which
are the most commonly used and were the scope of this bugfix and WL.
It works less fine for statements prepared via the SQL command
PREPARE...FROM, which are still not using the query cache if they
have at least one parameter (because then the expanded query contains
names of user variables, and user variables don't work with the
query cache, even in non-prepared queries).
Note that results from prepared SELECTs, which are in the binary
protocol, and results from normal SELECTs, which are in the text
protocol, ignore each other in the query cache, because a result in the
binary protocol should never be served to a SELECT expecting the text
protocol and vice-versa.
Note, after this patch, bug 25843 starts applying to query cache
("changing default database between PREPARE and EXECUTE of statement
breaks binlog"), we need to fix it.
mysql-test/include/have_query_cache.inc:
Now prepared statements work with the query cache, so don't disable
prep stmts by default when doing a query cache test. All tests which
include this file will now be really tested against prepared
statements (in particular, query_cache.test).
mysql-test/r/query_cache.result:
result update
mysql-test/t/grant_cache.test:
Cannot enable this test in ps-protocol, because in normal protocol,
a SELECT failing due to insufficient privileges increments
Qcache_not_cached, while in ps-protocol, no.
In detail: in normal protocol,
the "access denied" errors on SELECT are issued at (stack trace):
mysql_parse/mysql_execute_command/execute_sqlcom_select/handle_select/
mysql_select/JOIN::prepare/setup_wild/insert_fields/
check_grant_all_columns/my_error/my_message_sql, which then calls
push_warning/query_cache_abort: at this moment,
query_cache_store_query() has been called, so query exists in cache,
so thd->net.query_cache_query!=NULL, so query_cache_abort() removes
the query from cache, which causes a query_cache.refused++ (thus,
a Qcache_not_cached++).
While in ps-protocol, the error is issued at prepare time;
for this mysql_test_select() is called, not execute_sqlcom_select()
(and that also leads to JOIN::prepare/etc). Thus, as
query_cache_store_query() has not been called,
thd->net.query_cache_query==NULL, so query_cache_abort() does nothing:
Qcache_not_cached is not incremented.
As this test prints Qcache_not_cached after SELECT failures,
we cannot enable this test in ps-protocol.
mysql-test/t/ndb_cache_multi2.test:
The principle of this test is: two mysqlds connected to one cluster,
both using their query cache. Queries are cached in server1
("select a!=3 from t1", "select * from t1"),
table t1 is modified in server2, we want to see that this invalidates
the query cache of server1. Invalidation with NDB works like this:
when a query is found in the query cache, NDB is asked if the tables
have changed. In this test, ha_ndbcluster calls NDB every millisecond
to collect change information about tables.
Due to this millisecond delay, there is need for a loop ("while...")
in this test, which waits until a query1 ("select a!=3 from t1") is
invalidated (which is equivalent to it returning
up-to-date results), and then expects query2 ("select * from t1")
to have been invalidated (see up-to-date results).
But when enabling --ps-protocol in this test, the logic breaks,
because query1 is still done via mysql_real_query() (see mysqltest.c:
eval_expr() always uses mysql_real_query()). So, query1 returning
up-to-date results is not a sign of it being invalidated in the cache,
because it was NOT in the cache ("select a!=3 from t1" on line 39
was done with prep stmts, while `select a!=3 from t1` is not,
thus the second does not see the first in the cache). Thus, we may run
query2 when cache still has not been invalidated.
The solution is to make the initial "select a!=3 from t1" run
as a normal query, this repairs the broken logic.
But note, "select * from t1" is still using prepared statements
which was the goal of this test with --ps-protocol.
mysql-test/t/query_cache.test:
now that prepared statements work with the query cache, we check
that results in binary protocol (prepared statements) and in text
protocol (normal queries) don't mix in the query cache even though
the text of the statement/query are identical.
sql/mysql_priv.h:
In class Query_cache_flags, we add a bit to say if the result
is in binary or text format (because, a result in binary format
should never be served to a query expecting text format, and vice-
versa).
A macro to emphasize that we read the size of the query cache
without mutex ("maybe" word).
A macro which gives a first indication of if a query is cache-able
(first indication - it does not consider the query cache's state).
sql/protocol.cc:
indentation.
sql/protocol.h:
Children classes of Protocol report their type (currently,
text or binary). Query cache needs to know that.
sql/sql_cache.cc:
When we store a result in the query cache, we need to remember if it's
in binary or text format. And when we search for a result in the query
cache, we need to select only those results which are in the format
which the current statement expects (binary or text).
sql/sql_prepare.cc:
Enabling use of the query cache by prepared statements.
1) Prep stmts are of two types:
a) prepared via the mysql_stmt_prepare() API call
b) prepared via the SQL PREPARE...FROM statement.
2) We already, when executing a prepared statement, sometimes built an
"expanded" statement. For a), "?" placeholders were replaced by their
values. For b), by names of the user variables containing the values.
We did that only when we needed to write the query to logs.
We now use this expanded query also for storing/searching
in the query cache.
Assume a query "SELECT * FROM T WHERE c=?", and the parameter is 10.
For a), the expanded query is "SELECT * FROM T WHERE c=10", we look
for "SELECT * FROM T WHERE c=10" in the query cache, and store that
query's result in the query cache.
For b), the expanded query is "SELECT * FROM T WHERE c=@somevar", and
user variables don't work with the query cache (even inside non-
prepared queries), so we don't enable query caching for SQL PREPARE'd
statements if they have at least one parameter (see
"if (stmt->param_count > 0)" in the patch).
3) If query cache is enabled and this is a SELECT, we build the
expanded query (as an optimisation, we don't want to build this
expanded query if the query cache is disabled or this is not a SELECT).
As the decision of building the expanded query or not is taken
at prepare time (setup_set_params()), if query cache is disabled
at prepare time, we won't build the expanded query at all next
executions, thus shouldn't use this query for query cacheing.
To ensure that we don't, we set safe_to_cache_query to FALSE.
Note that we read the size of the query cache without mutex, which is
ok: if we see it 0 but that cache has just been enlarged, no big deal,
just our statement will not use the query cache; if we see it >0 but
that cache has just been made destroyed, we'll build the expanded
query at all executions, but query_cache_store_query() and
query_cache_send_result_to_client() will read the size with a mutex
and so properly decide to cache or not cache.
4) Some functions in this file were named "withlog", others "with_log",
now using "with_log" for all.
tests/mysql_client_test.c:
Testing of how prepared statements enter and hit the query cache.
test_ps_query_cache() is inspired from test_ps_conj_select().
It creates data, a prepared SELECT statement, executes it once,
then a second time with the same parameter value, to see that cache
is hit, then a 3rd time with another parameter value to see that cache
is not hit. Then, same from another connection, expecting hits.
Then, tests border cases (enables query cache at prepare and disables
at execute and vice-versa).
It checks all results of SELECTs, cache hits and misses.
mysql-test/r/query_cache_sql_prepare.result:
result of new test: we see hits when there is no parameter,
no hit when there is a parameter.
mysql-test/t/query_cache_sql_prepare.test:
new test to see if SQL PREPARE'd statements enter/hit the query cache:
- if having at least one parameter, they should not
- if having zero parameters, they should.
2007-03-09 18:09:57 +01:00
|
|
|
|
create table t1(c1 int);
|
|
|
|
|
insert into t1 values(1),(10),(100);
|
|
|
|
|
select * from t1;
|
|
|
|
|
c1
|
|
|
|
|
1
|
|
|
|
|
10
|
|
|
|
|
100
|
|
|
|
|
select * from t1;
|
|
|
|
|
c1
|
|
|
|
|
1
|
|
|
|
|
10
|
|
|
|
|
100
|
|
|
|
|
select * from t1;
|
|
|
|
|
c1
|
|
|
|
|
1
|
|
|
|
|
10
|
|
|
|
|
100
|
|
|
|
|
select * from t1;
|
|
|
|
|
c1
|
|
|
|
|
1
|
|
|
|
|
10
|
|
|
|
|
100
|
|
|
|
|
drop table t1;
|
2006-11-14 17:50:44 +01:00
|
|
|
|
set global query_cache_size=0;
|
2007-05-08 11:24:07 +02:00
|
|
|
|
create table t1 (a int);
|
|
|
|
|
insert into t1 values (1),(2),(3);
|
|
|
|
|
set GLOBAL query_cache_type=1;
|
|
|
|
|
set GLOBAL query_cache_limit=10000;
|
|
|
|
|
set GLOBAL query_cache_min_res_unit=0;
|
|
|
|
|
set GLOBAL query_cache_size= 100000;
|
|
|
|
|
reset query cache;
|
|
|
|
|
set LOCAL default_week_format = 0;
|
|
|
|
|
select week('2007-01-04');
|
|
|
|
|
week('2007-01-04')
|
|
|
|
|
0
|
|
|
|
|
select week('2007-01-04') from t1;
|
|
|
|
|
week('2007-01-04')
|
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
select extract(WEEK FROM '2007-01-04') from t1;
|
|
|
|
|
extract(WEEK FROM '2007-01-04')
|
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
0
|
|
|
|
|
set LOCAL default_week_format = 2;
|
|
|
|
|
select week('2007-01-04');
|
|
|
|
|
week('2007-01-04')
|
|
|
|
|
53
|
|
|
|
|
select week('2007-01-04') from t1;
|
|
|
|
|
week('2007-01-04')
|
|
|
|
|
53
|
|
|
|
|
53
|
|
|
|
|
53
|
|
|
|
|
select extract(WEEK FROM '2007-01-04') from t1;
|
|
|
|
|
extract(WEEK FROM '2007-01-04')
|
|
|
|
|
53
|
|
|
|
|
53
|
|
|
|
|
53
|
|
|
|
|
reset query cache;
|
|
|
|
|
set LOCAL div_precision_increment=2;
|
|
|
|
|
select 1/7;
|
|
|
|
|
1/7
|
|
|
|
|
0.14
|
|
|
|
|
select 1/7 from t1;
|
|
|
|
|
1/7
|
|
|
|
|
0.14
|
|
|
|
|
0.14
|
|
|
|
|
0.14
|
|
|
|
|
set LOCAL div_precision_increment=4;
|
|
|
|
|
select 1/7;
|
|
|
|
|
1/7
|
|
|
|
|
0.1429
|
|
|
|
|
select 1/7 from t1;
|
|
|
|
|
1/7
|
|
|
|
|
0.1429
|
|
|
|
|
0.1429
|
|
|
|
|
0.1429
|
|
|
|
|
drop table t1;
|
|
|
|
|
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
|
|
|
|
|
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
|
|
|
|
|
('Full-text indexes', 'are called collections'),
|
|
|
|
|
('Only MyISAM tables','support collections'),
|
|
|
|
|
('Function MATCH ... AGAINST()','is used to do a search'),
|
|
|
|
|
('Full-text search in MySQL', 'implements vector space model');
|
|
|
|
|
set GLOBAL ft_boolean_syntax='+ -><()~*:""&|';
|
|
|
|
|
select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
|
|
|
|
|
a b x
|
|
|
|
|
MySQL has now support for full-text search 0
|
|
|
|
|
Full-text indexes are called collections 1
|
|
|
|
|
Only MyISAM tables support collections 0
|
|
|
|
|
Function MATCH ... AGAINST() is used to do a search 0
|
|
|
|
|
Full-text search in MySQL implements vector space model 0
|
|
|
|
|
set GLOBAL ft_boolean_syntax='- +><()~*:""&|';
|
|
|
|
|
select *, MATCH(a,b) AGAINST("+called +collections" IN BOOLEAN MODE) as x from t1;
|
|
|
|
|
a b x
|
|
|
|
|
MySQL has now support for full-text search 0
|
|
|
|
|
Full-text indexes are called collections 0
|
|
|
|
|
Only MyISAM tables support collections 0
|
|
|
|
|
Function MATCH ... AGAINST() is used to do a search 0
|
|
|
|
|
Full-text search in MySQL implements vector space model 0
|
2007-05-08 11:56:47 +02:00
|
|
|
|
create function change_global() returns integer deterministic
|
2007-05-08 11:24:07 +02:00
|
|
|
|
begin
|
|
|
|
|
set global ft_boolean_syntax='+ -><()~*:""&|';
|
|
|
|
|
return 1;
|
|
|
|
|
end|
|
|
|
|
|
select *, change_global() from t1;
|
|
|
|
|
a b change_global()
|
|
|
|
|
MySQL has now support for full-text search 1
|
|
|
|
|
Full-text indexes are called collections 1
|
|
|
|
|
Only MyISAM tables support collections 1
|
|
|
|
|
Function MATCH ... AGAINST() is used to do a search 1
|
|
|
|
|
Full-text search in MySQL implements vector space model 1
|
|
|
|
|
drop function change_global;
|
2007-06-13 20:23:25 +02:00
|
|
|
|
drop table t1;
|
2007-05-08 11:24:07 +02:00
|
|
|
|
set GLOBAL query_cache_type=default;
|
|
|
|
|
set GLOBAL query_cache_limit=default;
|
|
|
|
|
set GLOBAL query_cache_min_res_unit=default;
|
|
|
|
|
set GLOBAL query_cache_size= default;
|
2007-06-13 20:23:25 +02:00
|
|
|
|
set GLOBAL query_cache_size=1000000;
|
|
|
|
|
create table t1 (a char);
|
|
|
|
|
insert into t1 values ('c');
|
|
|
|
|
a
|
|
|
|
|
drop table t1;
|
|
|
|
|
set GLOBAL query_cache_size= default;
|
Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
Changed code to enforce that SQL_CACHE only in the first SELECT is used to turn on caching(as documented), but any SQL_NO_CACHE will turn off caching (not documented, but a useful behaviour, especially for machine generated queries). Added test cases to explicitly test the documented caching behaviour and test cases for the reported bug.
mysql-test/r/query_cache.result:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
mysql-test/t/query_cache.test:
Added non-bug specific tests that ensure that only SQL_CACHE in the first SELECT is respected when encountered by the parser. These tests validate what is already documented, that only the outer most SELECTS can use the SQL_CACHE option to turn on caching. Because it would break existing SQL applications, we do not return an error if the SQL_CACHE expression is found in nested SELECTs. Also added test to validate nested SELECT can contain SQL_NO_CACHE and it will always turn off caching for the whole query.
Also added a bug specific test case to validate that the buggy behavior as reported has been fixed.
sql/sql_yacc.yy:
Added an explicit check to make sure "SELECT SQL_CACHE" only works on the first select in a query.
The parser will always hit the outermost SELECT first, and if the SQL_CACHE option is found it sets the safe_to_query flag in the lex. Then, if there are subseqent "uncachable" subqueries or functions, as it parses those elements it sets the safe_to_query to 0. However, this cause problems if nested SELECTs also used the SQL_CACHE option, because then it would set back safe_to_query to 1, even though there are uncacheable expressions previously parsed.
By adding the check to ensure only the first SELECT can turn caching on, it means a subsequent SQL_CACHE option can't turn caching back on after a uncacheable subsequery was already encountered.
2007-06-18 23:16:20 +02:00
|
|
|
|
set GLOBAL query_cache_size=1000000;
|
|
|
|
|
create table t1 (a char);
|
|
|
|
|
insert into t1 values ('c');
|
|
|
|
|
a
|
|
|
|
|
drop table t1;
|
|
|
|
|
set GLOBAL query_cache_size= default;
|
2007-07-28 13:01:29 +02:00
|
|
|
|
SET GLOBAL query_cache_size=64*1024*1024;
|
|
|
|
|
CREATE TABLE t1 (id INT);
|
|
|
|
|
CREATE PROCEDURE proc29856(IN theUPC TEXT)
|
|
|
|
|
BEGIN
|
|
|
|
|
SET @stmtStr := '';
|
|
|
|
|
SELECT CONCAT("SELECT id FROM t1 WHERE id IN (",theUPC,")") INTO @stmtStr;
|
|
|
|
|
PREPARE stmt FROM @stmtStr;
|
|
|
|
|
EXECUTE stmt;
|
|
|
|
|
END |
|
|
|
|
|
CALL proc29856('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
|
|
|
|
|
25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,
|
|
|
|
|
51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,
|
|
|
|
|
77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,
|
|
|
|
|
102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,
|
|
|
|
|
121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,
|
|
|
|
|
140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
|
|
|
|
|
159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,
|
|
|
|
|
178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,
|
|
|
|
|
197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
|
|
|
|
|
216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,
|
|
|
|
|
235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,
|
|
|
|
|
254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,
|
|
|
|
|
273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,
|
|
|
|
|
292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,
|
|
|
|
|
311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,
|
|
|
|
|
330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,
|
|
|
|
|
349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,
|
|
|
|
|
368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,
|
|
|
|
|
387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,
|
|
|
|
|
406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,
|
|
|
|
|
425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,
|
|
|
|
|
444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,
|
|
|
|
|
463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,
|
|
|
|
|
482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,
|
|
|
|
|
501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,
|
|
|
|
|
520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,
|
|
|
|
|
539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,
|
|
|
|
|
558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,
|
|
|
|
|
577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,
|
|
|
|
|
596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,
|
|
|
|
|
615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,
|
|
|
|
|
634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,
|
|
|
|
|
653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,
|
|
|
|
|
672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,
|
|
|
|
|
691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,
|
|
|
|
|
710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,
|
|
|
|
|
729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,
|
|
|
|
|
748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,
|
|
|
|
|
767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,
|
|
|
|
|
786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,
|
|
|
|
|
805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,
|
|
|
|
|
824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,
|
|
|
|
|
843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,
|
|
|
|
|
862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,
|
|
|
|
|
881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,
|
|
|
|
|
900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,
|
|
|
|
|
919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,
|
|
|
|
|
938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,
|
|
|
|
|
957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,
|
|
|
|
|
976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,
|
|
|
|
|
995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,
|
|
|
|
|
1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,
|
|
|
|
|
1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,
|
|
|
|
|
1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,
|
|
|
|
|
1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,
|
|
|
|
|
1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,
|
|
|
|
|
1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,
|
|
|
|
|
1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,
|
|
|
|
|
1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,
|
|
|
|
|
1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,
|
|
|
|
|
1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,
|
|
|
|
|
1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,
|
|
|
|
|
1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,
|
|
|
|
|
1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,
|
|
|
|
|
1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,
|
|
|
|
|
1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,
|
|
|
|
|
1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,
|
|
|
|
|
1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,
|
|
|
|
|
1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,
|
|
|
|
|
1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,
|
|
|
|
|
1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,
|
|
|
|
|
1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,
|
|
|
|
|
1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,
|
|
|
|
|
1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,
|
|
|
|
|
1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,
|
|
|
|
|
1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,
|
|
|
|
|
1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,
|
|
|
|
|
1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,
|
|
|
|
|
1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,
|
|
|
|
|
1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,
|
|
|
|
|
1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,
|
|
|
|
|
1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,
|
|
|
|
|
1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,
|
|
|
|
|
1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,
|
|
|
|
|
1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,
|
|
|
|
|
1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,
|
|
|
|
|
1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,
|
|
|
|
|
1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,
|
|
|
|
|
1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,
|
|
|
|
|
1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,
|
|
|
|
|
1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,
|
|
|
|
|
1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,
|
|
|
|
|
1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,
|
|
|
|
|
1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,
|
|
|
|
|
1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,
|
|
|
|
|
1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,
|
|
|
|
|
1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,
|
|
|
|
|
1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,
|
|
|
|
|
1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,
|
|
|
|
|
1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,
|
|
|
|
|
1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,
|
|
|
|
|
1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,
|
|
|
|
|
1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,
|
|
|
|
|
1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,
|
|
|
|
|
1806,1807,1808,1809,1810,1811');
|
|
|
|
|
id
|
|
|
|
|
DROP PROCEDURE proc29856;
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
SET GLOBAL query_cache_size= default;
|
2008-03-06 12:40:46 +01:00
|
|
|
|
#
|
|
|
|
|
# Bug#25132 disabled query cache: Qcache_free_blocks = 1
|
|
|
|
|
#
|
|
|
|
|
set global query_cache_size=100000;
|
|
|
|
|
set global query_cache_size=0;
|
|
|
|
|
set global query_cache_type=0;
|
|
|
|
|
show status like 'Qcache_free_blocks';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_free_blocks 0
|
|
|
|
|
Restore default values.
|
2007-07-12 13:29:51 +02:00
|
|
|
|
set GLOBAL query_cache_type=default;
|
|
|
|
|
set GLOBAL query_cache_limit=default;
|
|
|
|
|
set GLOBAL query_cache_min_res_unit=default;
|
|
|
|
|
set GLOBAL query_cache_size=default;
|
2011-05-18 15:27:19 +02:00
|
|
|
|
set local query_cache_type=default;
|
2008-03-13 16:39:27 +01:00
|
|
|
|
FLUSH STATUS;
|
|
|
|
|
SET GLOBAL query_cache_size=10*1024*1024;
|
|
|
|
|
SET @save_concurrent_insert= @@concurrent_insert;
|
|
|
|
|
SET GLOBAL concurrent_insert= 0;
|
|
|
|
|
CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=MyISAM;
|
|
|
|
|
INSERT INTO t1 (c1) VALUES (1), (2);
|
|
|
|
|
SHOW GLOBAL VARIABLES LIKE 'concurrent_insert';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
concurrent_insert 0
|
|
|
|
|
SHOW STATUS LIKE 'Qcache_hits';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 0
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
c1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
c1
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
SHOW STATUS LIKE 'Qcache_hits';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 1
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
SET GLOBAL concurrent_insert= @save_concurrent_insert;
|
|
|
|
|
SET GLOBAL query_cache_size= default;
|
2009-01-13 23:07:06 +01:00
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
|
FLUSH STATUS;
|
|
|
|
|
SET GLOBAL query_cache_size=1048576;
|
|
|
|
|
CREATE TABLE t1 (a INT);
|
|
|
|
|
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
|
|
|
|
SHOW STATUS LIKE 'Qcache_queries_in_cache';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 0
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
BEGIN;
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
COMMIT;
|
|
|
|
|
SHOW STATUS LIKE 'Qcache_queries_in_cache';
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_queries_in_cache 2
|
|
|
|
|
SHOW STATUS LIKE "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 0
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
BEGIN;
|
|
|
|
|
SELECT * FROM t1;
|
|
|
|
|
a
|
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
COMMIT;
|
|
|
|
|
SHOW STATUS LIKE "Qcache_hits";
|
|
|
|
|
Variable_name Value
|
|
|
|
|
Qcache_hits 2
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
SET GLOBAL query_cache_size= default;
|
Fix multiple test suite failures in Buildbot due to races in the test cases or missing server features not properly checked
mysql-test/r/func_misc.result:
Move test that requires query cache from main.func_misc to main.query_cache.
mysql-test/r/mysqltest.result:
Fix test failure due to race.
This test case creates > 300 connections in a tight loop, and depending on thread
scheduling and load, even though each connection is immediately disconnected
before connecting the next one, the server max connections may still be exceeded
due to server not being able to free old connections as fast as new ones are made.
mysql-test/r/query_cache.result:
Move test that requires query cache from main.func_misc to main.query_cache.
Move test that requires query cache from main.variables to main.query_cache.
mysql-test/r/query_cache_notembedded.result:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/r/sp_notembedded.result:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/r/udf.result:
Move test in main.udf that requires query cache to separate file.
mysql-test/r/udf_query_cache.result:
Move test in main.udf that requires query cache to separate file.
mysql-test/r/variables.result:
Move test that requires query cache from main.variables to main.query_cache.
mysql-test/suite/funcs_1/datadict/processlist_val.inc:
Fix race where result file may show state "cleaning up" in the small window
between setting COMMAND to 'Sleep' and clearing STATE.
mysql-test/suite/rpl/r/rpl_temporary.result:
Fix race with suppression of warning message by fixing the test to not generate the
warning message in the first place.
Problem was a race between creating an anonymous account and resetting the slave.
If the slave reset happens before replicating the account, the subsequest deletion
of the account will fail to replicate correctly due to missing row.
mysql-test/suite/rpl/t/rpl_temporary.test:
Fix race with suppression of warning message by fixing the test to not generate the
warning message in the first place.
Problem was a race between creating an anonymous account and resetting the slave.
If the slave reset happens before replicating the account, the subsequest deletion
of the account will fail to replicate correctly due to missing row.
mysql-test/t/func_misc.test:
Move test that requires query cache from main.func_misc to main.query_cache.
Move test that requires query cache from main.variables to main.query_cache.
mysql-test/t/mysqltest.test:
Fix test failure due to race.
This test case creates > 300 connections in a tight loop, and depending on thread
scheduling and load, even though each connection is immediately disconnected
before connecting the next one, the server max connections may still be exceeded
due to server not being able to free old connections as fast as new ones are made.
mysql-test/t/query_cache.test:
Move test that requires query cache to main.query_cache.
mysql-test/t/query_cache_notembedded.test:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/t/sp_notembedded.test:
Move test that requires query cache from main.sp_notembedded to main.query_cache_notembedded.
mysql-test/t/udf.test:
Move test in main.udf that requires query cache to separate file.
mysql-test/t/udf_query_cache-master.opt:
Move test in main.udf that requires query cache to separate file.
mysql-test/t/udf_query_cache.test:
Move test in main.udf that requires query cache to separate file.
mysql-test/t/variables.test:
Move test that requires query cache from main.variables to main.query_cache.
tests/mysql_client_test.c:
In tests that require query cache, skip the test if query cache not available.
Do this dynamically rather than using HAVE_QUERY_CACHE, as there is no guarantee
that the server we run against was compiled with same preprocessor #define as
the mysql_client_test program (and since it is trivial to check dynamically).
2010-01-11 14:15:28 +01:00
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
|
# Tests for Bug#6760 and Bug#12689
|
|
|
|
|
SET @row_count = 4;
|
|
|
|
|
SET @sleep_time_per_result_row = 1;
|
|
|
|
|
SET @max_acceptable_delay = 2;
|
|
|
|
|
SET @@global.query_cache_size = 1024 * 64;
|
|
|
|
|
DROP TEMPORARY TABLE IF EXISTS t_history;
|
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
|
CREATE TEMPORARY TABLE t_history (attempt SMALLINT,
|
|
|
|
|
start_ts DATETIME, end_ts DATETIME,
|
|
|
|
|
start_cached INTEGER, end_cached INTEGER);
|
|
|
|
|
CREATE TABLE t1 (f1 BIGINT);
|
|
|
|
|
INSERT INTO t_history
|
|
|
|
|
SET attempt = 4 - 4 + 1, start_ts = NOW(),
|
|
|
|
|
start_cached = 0;
|
|
|
|
|
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
|
|
|
|
|
f1 SLEEP(@sleep_time_per_result_row)
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
UPDATE t_history SET end_ts = NOW()
|
|
|
|
|
WHERE attempt = 4 - 4 + 1;
|
|
|
|
|
UPDATE t_history SET end_cached = 0
|
|
|
|
|
WHERE attempt = 4 - 4 + 1;
|
|
|
|
|
INSERT INTO t_history
|
|
|
|
|
SET attempt = 4 - 3 + 1, start_ts = NOW(),
|
|
|
|
|
start_cached = 0;
|
|
|
|
|
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
|
|
|
|
|
f1 SLEEP(@sleep_time_per_result_row)
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
UPDATE t_history SET end_ts = NOW()
|
|
|
|
|
WHERE attempt = 4 - 3 + 1;
|
|
|
|
|
UPDATE t_history SET end_cached = 0
|
|
|
|
|
WHERE attempt = 4 - 3 + 1;
|
|
|
|
|
INSERT INTO t_history
|
|
|
|
|
SET attempt = 4 - 2 + 1, start_ts = NOW(),
|
|
|
|
|
start_cached = 0;
|
|
|
|
|
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
|
|
|
|
|
f1 SLEEP(@sleep_time_per_result_row)
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
UPDATE t_history SET end_ts = NOW()
|
|
|
|
|
WHERE attempt = 4 - 2 + 1;
|
|
|
|
|
UPDATE t_history SET end_cached = 0
|
|
|
|
|
WHERE attempt = 4 - 2 + 1;
|
|
|
|
|
INSERT INTO t_history
|
|
|
|
|
SET attempt = 4 - 1 + 1, start_ts = NOW(),
|
|
|
|
|
start_cached = 0;
|
|
|
|
|
SELECT *, SLEEP(@sleep_time_per_result_row) FROM t1;
|
|
|
|
|
f1 SLEEP(@sleep_time_per_result_row)
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
1 0
|
|
|
|
|
UPDATE t_history SET end_ts = NOW()
|
|
|
|
|
WHERE attempt = 4 - 1 + 1;
|
|
|
|
|
UPDATE t_history SET end_cached = 0
|
|
|
|
|
WHERE attempt = 4 - 1 + 1;
|
|
|
|
|
# Test 1: Does the query with SLEEP need a reasonable time?
|
|
|
|
|
SELECT COUNT(*) >= 4 - 1 INTO @aux1 FROM t_history
|
|
|
|
|
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
|
|
|
|
|
BETWEEN 0 AND @max_acceptable_delay;
|
|
|
|
|
SELECT @aux1 AS "Expect 1";
|
|
|
|
|
Expect 1
|
|
|
|
|
1
|
|
|
|
|
# Test 2: Does the query with SLEEP need a reasonable time even in case
|
|
|
|
|
# of the non first execution?
|
|
|
|
|
SELECT COUNT(*) >= 4 - 1 - 1 INTO @aux2 FROM t_history
|
|
|
|
|
WHERE TIMEDIFF(end_ts,start_ts) - @sleep_time_per_result_row * @row_count
|
|
|
|
|
BETWEEN 0 AND @max_acceptable_delay
|
|
|
|
|
AND attempt > 1;
|
|
|
|
|
SELECT @aux2 AS "Expect 1";
|
|
|
|
|
Expect 1
|
|
|
|
|
1
|
|
|
|
|
# Test 3: The query with SLEEP must be not cached.
|
|
|
|
|
SELECT COUNT(*) = 4 INTO @aux3 FROM t_history
|
|
|
|
|
WHERE end_cached = start_cached;
|
|
|
|
|
SELECT @aux3 AS "Expect 1";
|
|
|
|
|
Expect 1
|
|
|
|
|
1
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
DROP TEMPORARY TABLE t_history;
|
|
|
|
|
SET @@global.query_cache_size = default;
|
2007-07-16 21:31:36 +02:00
|
|
|
|
End of 5.0 tests
|
2009-11-03 17:18:43 +01:00
|
|
|
|
SET GLOBAL query_cache_size=1024*1024*512;
|
2007-10-19 14:43:19 +02:00
|
|
|
|
CREATE TABLE t1 (a ENUM('rainbow'));
|
|
|
|
|
INSERT INTO t1 VALUES (),(),(),(),();
|
|
|
|
|
SELECT 1 FROM t1 GROUP BY (SELECT 1 FROM t1 ORDER BY AVG(LAST_INSERT_ID()));
|
|
|
|
|
1
|
|
|
|
|
1
|
|
|
|
|
DROP TABLE t1;
|
|
|
|
|
CREATE TABLE t1 (a LONGBLOB);
|
|
|
|
|
INSERT INTO t1 SET a = 'aaaa';
|
|
|
|
|
INSERT INTO t1 SET a = 'aaaa';
|
2007-10-23 16:28:47 +02:00
|
|
|
|
SELECT 1 FROM t1 GROUP BY
|
2007-10-19 14:43:19 +02:00
|
|
|
|
(SELECT LAST_INSERT_ID() FROM t1 ORDER BY MIN(a) ASC LIMIT 1);
|
|
|
|
|
1
|
|
|
|
|
1
|
|
|
|
|
DROP TABLE t1;
|
2009-11-03 17:18:43 +01:00
|
|
|
|
SET GLOBAL query_cache_size= default;
|
2007-07-16 21:31:36 +02:00
|
|
|
|
End of 5.1 tests
|
2011-05-18 15:27:19 +02:00
|
|
|
|
New query cache switching OFF mechanism test
|
|
|
|
|
set global query_cache_size=1024*1024*20;
|
|
|
|
|
set global query_cache_type=on;
|
|
|
|
|
select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
|
|
|
|
|
@@query_cache_size @@global.query_cache_type @@local.query_cache_type
|
|
|
|
|
20971520 ON ON
|
|
|
|
|
set global query_cache_size=0;
|
|
|
|
|
select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
|
|
|
|
|
@@query_cache_size @@global.query_cache_type @@local.query_cache_type
|
|
|
|
|
0 ON ON
|
|
|
|
|
set global query_cache_size=1024*1024*20;
|
|
|
|
|
select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
|
|
|
|
|
@@query_cache_size @@global.query_cache_type @@local.query_cache_type
|
|
|
|
|
20971520 ON ON
|
|
|
|
|
set global query_cache_type=off;
|
|
|
|
|
select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
|
|
|
|
|
@@query_cache_size @@global.query_cache_type @@local.query_cache_type
|
|
|
|
|
20971520 OFF OFF
|
|
|
|
|
set global query_cache_type=on;
|
|
|
|
|
select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
|
|
|
|
|
@@query_cache_size @@global.query_cache_type @@local.query_cache_type
|
|
|
|
|
20971520 ON OFF
|
|
|
|
|
set local query_cache_type= on;
|
|
|
|
|
select @@query_cache_size, @@global.query_cache_type, @@local.query_cache_type;
|
|
|
|
|
@@query_cache_size @@global.query_cache_type @@local.query_cache_type
|
|
|
|
|
20971520 ON ON
|
|
|
|
|
restore defaults
|
|
|
|
|
SET GLOBAL query_cache_type= default;
|
|
|
|
|
SET GLOBAL query_cache_size= default;
|
|
|
|
|
SET LOCAL query_cache_type= default;
|