Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
5.3.12, 5.5.36, 10.0.9, 10.6, 10.11, 10.5(EOL)
-
None
Description
The following example over the world database from the 5.3/mysql-test/include directory
shows that a query that uses an index access to compute GROUP BY has the same cost
as the same query without index access (using temp table). At the same time the two
different query plans indeed show different number of Handler_read_* calls.
Test script:
create database world;
|
use world;
|
|
--source include/world_schema.inc
|
--source include/world.inc
|
|
create index cityname on City(Name);
|
|
explain
|
SELECT name FROM City GROUP BY name HAVING Count(*) > 2;
|
flush status;
|
SELECT name FROM City GROUP BY name HAVING Count(*) > 2;
|
show status like 'last_query_cost';
|
show status like 'Handler_read%';
|
|
explain
|
SELECT name FROM City ignore index (cityname) GROUP BY name HAVING Count(*) > 2;
|
flush status;
|
SELECT name FROM City ignore index (cityname) GROUP BY name HAVING Count(*) > 2;
|
show status like 'last_query_cost';
|
show status like 'Handler_read%';
|