Bug #82074 Select_scan set even if table scan was not used
Submitted: 30 Jun 2016 21:50 Modified: 1 Jul 2016 5:04
Reporter: Sveta Smirnova (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:5.5.49, 5.6.30, 5.7.13 OS:Any
Assigned to: CPU Architecture:Any

[30 Jun 2016 21:50] Sveta Smirnova
Description:
Originally reported at https://bugs.launchpad.net/percona-server/+bug/1597131

Even if table scan is not used Select_scan status variable still can be set to 1

How to repeat:
explain select i from joinit limit 100;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	joinit	index	NULL	PRIMARY	4	NULL	32768	Using index
flush status;
select i from joinit limit 100;
show status like '%scan%';
Variable_name	Value
Select_scan	1
Sort_scan	0
show status like 'Handler%';
Variable_name	Value
Handler_commit	1
Handler_delete	0
Handler_discover	0
Handler_external_lock	2
Handler_mrr_init	0
Handler_prepare	0
Handler_read_first	1
Handler_read_key	1
Handler_read_last	0
Handler_read_next	99
Handler_read_prev	0
Handler_read_rnd	0
Handler_read_rnd_next	0
Handler_rollback	0
Handler_savepoint	0
Handler_savepoint_rollback	0
Handler_update	0
Handler_write	0

Full text case will be attached
[30 Jun 2016 21:51] Sveta Smirnova
Test case for MTR

Attachment: bug1597131.test (application/octet-stream, text), 1.91 KiB.

[1 Jul 2016 5:04] MySQL Verification Team
Hello Sveta,

Thank you for the report and test case.
Verified as described with 5.5.50, 5.6.31 and 5.7.13.

Thanks,
Umesh