Bug #5333 | "const" access type does not print "using index" or does not use index only | ||
---|---|---|---|
Submitted: | 1 Sep 2004 6:28 | Modified: | 8 Sep 2004 4:15 |
Reporter: | Peter Zaitsev (Basic Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.4 | OS: | Any (all) |
Assigned to: | Igor Babaev | CPU Architecture: | Any |
[1 Sep 2004 6:28]
Peter Zaitsev
[3 Sep 2004 8:46]
Igor Babaev
The bug is due to the fact that there is no setting for field index of the JOIN_TAB structure for const tables in the function join_read_const_table. As a result the value of this field is always 0. Nevertheless the function select_describe is trying to use the value of the field when checking whether the used index is covering or not. So the presence of note 'Using index' in the plan depends only on the ordinal number of the used index: only if it's the first index the note is there. In 4.0 both plans of the test case do not contain that note. It is also a bug. First I downported some code from 4.1 to to get the same result as in the test case. Then I added the statement tab->index= tab->ref.key after the statement table->file->extra(HA_EXTRA_KEYREAD) in join_read_const_table. I also added the test case to select.test. See ChangeSet: 1.1979 04/09/02 22:06:30 igor@rurik.mysql.com +5 -0 for 4.0