Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
bd80d7e4
Commit
bd80d7e4
authored
Jun 19, 2007
by
dkatz@damien-katzs-computer.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge damien-katzs-computer.local:/Users/dkatz/mysql50
into damien-katzs-computer.local:/Users/dkatz/50_win
parents
b8eee54d
b89e4f9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
3 deletions
+92
-3
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+52
-1
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+34
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-2
No files found.
mysql-test/r/query_cache.result
View file @
bd80d7e4
...
@@ -179,12 +179,22 @@ a
...
@@ -179,12 +179,22 @@ a
1
1
2
2
3
3
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
show status like "Qcache_hits";
show status like "Qcache_hits";
Variable_name Value
Variable_name Value
Qcache_hits 4
Qcache_hits 4
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache
2
Qcache_queries_in_cache
1
set query_cache_type=on;
set query_cache_type=on;
reset query cache;
reset query cache;
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
...
@@ -195,6 +205,41 @@ a
...
@@ -195,6 +205,41 @@ a
1
1
2
2
3
3
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
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache 0
Qcache_queries_in_cache 0
...
@@ -1416,3 +1461,9 @@ insert into t1 values ('c');
...
@@ -1416,3 +1461,9 @@ insert into t1 values ('c');
a
a
drop table t1;
drop table t1;
set GLOBAL query_cache_size= default;
set GLOBAL query_cache_size= default;
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;
mysql-test/t/query_cache.test
View file @
bd80d7e4
...
@@ -89,7 +89,11 @@ show status like "Qcache_queries_in_cache";
...
@@ -89,7 +89,11 @@ show status like "Qcache_queries_in_cache";
select
sql_cache
*
from
t1
union
select
*
from
t1
;
select
sql_cache
*
from
t1
union
select
*
from
t1
;
set
query_cache_type
=
2
;
set
query_cache_type
=
2
;
select
sql_cache
*
from
t1
union
select
*
from
t1
;
select
sql_cache
*
from
t1
union
select
*
from
t1
;
# all sql_cache statements, except for the first select, are ignored.
select
*
from
t1
union
select
sql_cache
*
from
t1
;
select
*
from
t1
union
select
sql_cache
*
from
t1
;
select
*
from
t1
where
a
IN
(
select
sql_cache
a
from
t1
);
select
*
from
t1
where
a
IN
(
select
a
from
t1
union
select
sql_cache
a
from
t1
);
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_queries_in_cache"
;
set
query_cache_type
=
on
;
set
query_cache_type
=
on
;
...
@@ -102,6 +106,15 @@ show status like "Qcache_queries_in_cache";
...
@@ -102,6 +106,15 @@ show status like "Qcache_queries_in_cache";
# SELECT SQL_NO_CACHE
# SELECT SQL_NO_CACHE
#
#
select
sql_no_cache
*
from
t1
;
select
sql_no_cache
*
from
t1
;
# sql_no_cache can occur in any nested select to turn on cacheing for the whole
# expression and it will always override a sql_cache statement.
select
*
from
t1
union
select
sql_no_cache
*
from
t1
;
select
*
from
t1
where
a
IN
(
select
sql_no_cache
a
from
t1
);
select
*
from
t1
where
a
IN
(
select
a
from
t1
union
select
sql_no_cache
a
from
t1
);
select
sql_cache
sql_no_cache
*
from
t1
;
select
sql_cache
*
from
t1
union
select
sql_no_cache
*
from
t1
;
select
sql_cache
*
from
t1
where
a
IN
(
select
sql_no_cache
a
from
t1
);
select
sql_cache
*
from
t1
where
a
IN
(
select
a
from
t1
union
select
sql_no_cache
a
from
t1
);
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_queries_in_cache"
;
drop
table
t1
;
drop
table
t1
;
#
#
...
@@ -994,4 +1007,25 @@ drop table t1;
...
@@ -994,4 +1007,25 @@ drop table t1;
set
GLOBAL
query_cache_size
=
default
;
set
GLOBAL
query_cache_size
=
default
;
#
# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
#
set
GLOBAL
query_cache_size
=
1000000
;
create
table
t1
(
a
char
);
insert
into
t1
values
(
'c'
);
let
$q1
=
`select RAND() from t1 union select sql_cache 1 from t1;`
;
let
$q2
=
`select RAND() from t1 union select sql_cache 1 from t1;`
;
# disabling the logging of the query because the times are different each run.
--
disable_query_log
eval
select
a
from
t1
where
"
$q1
"
=
"
$q2
"
;
--
enable_query_log
drop
table
t1
;
set
GLOBAL
query_cache_size
=
default
;
# End of 5.0 tests
# End of 5.0 tests
sql/sql_yacc.yy
View file @
bd80d7e4
...
@@ -4363,8 +4363,12 @@ select_option:
...
@@ -4363,8 +4363,12 @@ select_option:
}
}
| SQL_CACHE_SYM
| SQL_CACHE_SYM
{
{
/* Honor this flag only if SQL_NO_CACHE wasn't specified. */
/*
if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE)
Honor this flag only if SQL_NO_CACHE wasn't specified AND
we are parsing the outermost SELECT in the query.
*/
if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE &&
Lex->current_select == &Lex->select_lex)
{
{
Lex->safe_to_cache_query=1;
Lex->safe_to_cache_query=1;
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment