Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.4(EOL), 10.5, 10.6, 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.3(EOL), 11.4, 11.5(EOL)
-
None
Description
If a query uses an index, and as a result all rows are filtered out, the query is not included in INDEX_STATISTICS. It seems strange – if the goal is to measure the efficiency of the index, then queries where the index allows to exclude all rows should surely be taken into account.
SET @userstat.save= @@userstat; |
|
CREATE TABLE t (a INT, KEY(a)) ENGINE=MyISAM; |
INSERT INTO t VALUES (1),(2),(3),(4),(5); |
SET GLOBAL userstat= 1; |
FLUSH INDEX_STATISTICS;
|
EXPLAIN SELECT a FROM t WHERE a = 6; |
SELECT a FROM t WHERE a = 6; |
SHOW INDEX_STATISTICS;
|
|
# Cleanup
|
DROP TABLE t; |
SET GLOBAL userstat= @userstat.save; |
10.4 662bb176b412993a085fe329af559ddc3dc83ec3 |
EXPLAIN SELECT a FROM t WHERE a = 6; |
id select_type table type possible_keys key key_len ref rows Extra |
1 SIMPLE t ref a a 5 const 1 Using index |
SELECT a FROM t WHERE a = 6; |
a
|
SHOW INDEX_STATISTICS;
|
Table_schema Table_name Index_name Rows_read
|
DROP TABLE t; |
Consequently, even if the index already exists in INDEX_STATISTICS due to previous resultive queries, THE QUERIES counter introduced in MDEV-33152 is not incremented on such an occasion.