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, if the queries are executed within a trigger, it only counts the query which caused the trigger execution, regardless how many times the triggers were executed and how many queries were within.
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.
See also MDEV-33903 – same for stored functions.
SET @userstat.save= @@userstat; |
set global userstat= 1; |
|
create or replace table t1 (a int, key(a)); |
insert into t1 values (1),(2),(3),(4),(1); |
create or replace table t2 (b int); |
create trigger tr before insert on t2 for each row set new.b = (select count(*) from t1 where a = new.b); |
flush index_statistics;
|
insert into t2 values (1),(2),(3),(4),(5); |
show index_statistics;
|
|
# Cleanup
|
set global userstat= @userstat.save; |
drop table t1, t2; |
bb-11.5-MDEV-33152-index-statistics 802e89b176efd8ef995cdd456a04ac6452f0e284 |
flush index_statistics;
|
insert into t2 values (1),(2),(3),(4),(5); |
show index_statistics;
|
Table_schema Table_name Index_name Rows_read Queries
|
test t1 a 5 1
|
Attachments
Issue Links
- is caused by
-
MDEV-33152 Add QUERIES to INDEX_STATISTICS
- Closed