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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
73f8b4da
Commit
73f8b4da
authored
Oct 16, 2013
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-4981: Account for queries handled by query-cache in USER_STATISTICS (and in HOST_STATISTICS)
fix for SP & PS
parent
2f4db534
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
1 deletion
+122
-1
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+67
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+40
-0
sql/sp_head.cc
sql/sp_head.cc
+8
-0
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+6
-0
No files found.
mysql-test/r/query_cache.result
View file @
73f8b4da
...
...
@@ -2008,7 +2008,74 @@ SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 2
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
create procedure p1()
select * from t1;
call p1;
a
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
where CLIENT="localhost";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
1 0 1
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
where USER="root";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
2 1 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
call p1;
a
call p1;
a
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
where CLIENT="localhost";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
5 2 3
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
where USER="root";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
6 3 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 2
FLUSH USER_STATISTICS;
FLUSH CLIENT_STATISTICS;
flush status;
SET GLOBAL query_cache_size= 0;
call p1;
a
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
where CLIENT="localhost";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
1 0 1
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
where USER="root";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
2 1 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
call p1;
a
call p1;
a
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.CLIENT_STATISTICS
where CLIENT="localhost";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
5 2 3
select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STATISTICS
where USER="root";
SELECT_COMMANDS ROWS_SENT EMPTY_QUERIES
6 3 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
drop procedure p1;
drop table t1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL userstat=default;
End of 5.5 tests
restore defaults
...
...
mysql-test/t/query_cache.test
View file @
73f8b4da
...
...
@@ -1665,7 +1665,47 @@ select SELECT_COMMANDS,ROWS_SENT,EMPTY_QUERIES from INFORMATION_SCHEMA.USER_STAT
where
USER
=
"root"
;
show
status
like
"Qcache_hits"
;
FLUSH
USER_STATISTICS
;
FLUSH
CLIENT_STATISTICS
;
flush
status
;
create
procedure
p1
()
select
*
from
t1
;
call
p1
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
CLIENT_STATISTICS
where
CLIENT
=
"localhost"
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
USER_STATISTICS
where
USER
=
"root"
;
show
status
like
"Qcache_hits"
;
call
p1
;
call
p1
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
CLIENT_STATISTICS
where
CLIENT
=
"localhost"
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
USER_STATISTICS
where
USER
=
"root"
;
show
status
like
"Qcache_hits"
;
FLUSH
USER_STATISTICS
;
FLUSH
CLIENT_STATISTICS
;
flush
status
;
SET
GLOBAL
query_cache_size
=
0
;
call
p1
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
CLIENT_STATISTICS
where
CLIENT
=
"localhost"
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
USER_STATISTICS
where
USER
=
"root"
;
show
status
like
"Qcache_hits"
;
call
p1
;
call
p1
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
CLIENT_STATISTICS
where
CLIENT
=
"localhost"
;
select
SELECT_COMMANDS
,
ROWS_SENT
,
EMPTY_QUERIES
from
INFORMATION_SCHEMA
.
USER_STATISTICS
where
USER
=
"root"
;
show
status
like
"Qcache_hits"
;
drop
procedure
p1
;
drop
table
t1
;
set
GLOBAL
query_cache_size
=
1355776
;
SET
GLOBAL
userstat
=
default
;
--
echo
End
of
5.5
tests
...
...
sql/sp_head.cc
View file @
73f8b4da
...
...
@@ -3137,7 +3137,15 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
log_slow_statement
(
thd
);
}
else
{
/* change statistics */
enum_sql_command
save_sql_command
=
thd
->
lex
->
sql_command
;
thd
->
lex
->
sql_command
=
SQLCOM_SELECT
;
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SELECT
]);
thd
->
update_stats
();
thd
->
lex
->
sql_command
=
save_sql_command
;
*
nextp
=
m_ip
+
1
;
}
thd
->
set_query
(
query_backup
);
thd
->
query_name_consts
=
0
;
...
...
sql/sql_parse.cc
View file @
73f8b4da
...
...
@@ -5791,7 +5791,7 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
{
/* Update statistics for getting the query from the cache */
thd
->
lex
->
sql_command
=
SQLCOM_SELECT
;
status_var_increment
(
thd
->
status_var
.
com_stat
[
thd
->
lex
->
sql_command
]);
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SELECT
]);
thd
->
update_stats
();
}
DBUG_VOID_RETURN
;
...
...
sql/sql_prepare.cc
View file @
73f8b4da
...
...
@@ -3905,6 +3905,12 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
error
=
mysql_execute_command
(
thd
);
MYSQL_QUERY_EXEC_DONE
(
error
);
}
else
{
thd
->
lex
->
sql_command
=
SQLCOM_SELECT
;
status_var_increment
(
thd
->
status_var
.
com_stat
[
SQLCOM_SELECT
]);
thd
->
update_stats
();
}
}
/*
...
...
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