Bug #57356 | MyISAM and InnoDB output difference on LIMIT query when PRIMARY KEY is used | ||
---|---|---|---|
Submitted: | 10 Oct 2010 21:21 | Modified: | 11 Oct 2010 1:23 |
Reporter: | Roel Van de Paar | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 5.0, 5.1, 5.5.6rc | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[10 Oct 2010 21:21]
Roel Van de Paar
[10 Oct 2010 21:23]
Roel Van de Paar
Without PRIMARY KEY(`chars`(100)): mysql> explain SELECT * FROM b LIMIT 500,1; +----+-------------+-------+------+---------------+------+---------+------+------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------+---------+------+------+-------+ | 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 825 | | +----+-------------+-------+------+---------------+------+---------+------+------+-------+ 1 row in set (0.00 sec) With PRIMARY KEY(`chars`(100)): mysql> explain SELECT * FROM b LIMIT 500,1; +----+-------------+-------+------+---------------+------+---------+------+------+-------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+------+---------------+------+---------+------+------+-------+ | 1 | SIMPLE | b | ALL | NULL | NULL | NULL | NULL | 786 | | +----+-------------+-------+------+---------------+------+---------+------+------+-------+ 1 row in set (0.00 sec)
[10 Oct 2010 21:49]
Peter Laursen
also reproducible for me with MySQL 5.1.51 (64 bit Windows)
[10 Oct 2010 21:52]
Peter Laursen
and on 5.5.6
[10 Oct 2010 21:58]
Roel Van de Paar
Verified on 5.5.6rc. Same result with InnoDB Plugin.
[10 Oct 2010 21:59]
Peter Laursen
and also 5.0.90
[11 Oct 2010 0:51]
MySQL Verification Team
What is the bug? Order isn't guaranteed unless you use and ORDER BY clause.
[11 Oct 2010 1:23]
Roel Van de Paar
Correct, forgot about ORDER BY requirement.