Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
N/A
-
None
Description
Unlike for procedure calls, where INDEX_STATISTICS.QUERIES counts relevant queries within the procedure, for functions it only counts the upper query, the one which executes the functions, regardless how many times the functions are executed and how many relevant queries they run inside.
Maybe it is intentional, but it's not clear from MDEV-33152 where the counter was added. If it's intentional, please convert it into a documentation request.
SET @userstat.save= @@userstat; |
set global userstat= 1; |
|
create table t (a int, key(a)) engine=MyISAM; |
insert into t values (1),(2),(3),(4),(1); |
--delimiter $
|
create function f() returns int |
begin
|
declare x int default 0; |
declare y int default 0; |
select count(*) into x from t where a = 1; |
select count(*) into y from t where a = 2; |
return x + y; |
end $ |
--delimiter ;
|
flush index_statistics;
|
select f() + f(); |
show index_statistics;
|
|
# Cleanup
|
set global userstat= @userstat.save; |
drop table t; |
drop function f; |
bb-11.5-MDEV-33152-index-statistics 802e89b176efd8ef995cdd456a04ac6452f0e284 |
show index_statistics;
|
Table_schema Table_name Index_name Rows_read Queries
|
test t a 6 1
|
Attachments
Issue Links
- is caused by
-
MDEV-33152 Add QUERIES to INDEX_STATISTICS
- Closed