Bug #74054 | Limit 1 returns second row not first one! | ||
---|---|---|---|
Submitted: | 24 Sep 2014 14:46 | Modified: | 26 Sep 2014 16:13 |
Reporter: | Pete French | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.6.20 | OS: | FreeBSD (9.3-STABLE) |
Assigned to: | CPU Architecture: | Any |
[24 Sep 2014 14:46]
Pete French
[25 Sep 2014 10:29]
Hartmut Holzgraefe
I can't reproduce this with 5.6.20, result set without LIMIT: *************************** 1. row *************************** promo_code: backend_system: nimax area_code: NMX venue_code: PLO/T event_code: 2649 perf_weekday: perf_yyyymmdd: perf_hhmm: perf_type_code: mod_group: standard_affiliate discounts_perm_list: +TSW/IL2/1 pkg_discounts_perm_list: close_in_day_limit: 0 close_in_discounts_perm_list: close_in_pkg_discounts_perm_list: far_out_day_limit: 0 far_out_discounts_perm_list: far_out_pkg_discounts_perm_list: comment: *************************** 2. row *************************** promo_code: backend_system: nimax area_code: venue_code: event_code: perf_weekday: perf_yyyymmdd: perf_hhmm: perf_type_code: mod_group: standard_affiliate discounts_perm_list: +TSW/IAR*,+TSW/ING*,+TSW/INR*,+TSW/PRX/*,+TSW/IA3/*,+TSW/IA4/*,+TSW/IA2/*,+TSW/A11/*,+TSW/A12/*,+TSW/FUL/*, +TSW/OPG/*,+TSW/SPN/*,+TSW/TAW/*,+TSW/TS1*,-TSW/TS2*,+TSW/TS5/1,+TSW/TS6/1,+TSW/TSP/1,+TSW/BEE/*,+TSW/TSW*,+TSW/AFF*,+TSW/AF1*,+TSW/IN1/*,+TSW/IN2/*,+TSW/IN3/*,+TSW/IN4/*,+TSW/IN5/*,+TSW/IN6/*,+TSW/SIF/*,+TSW/PRV/*,+TSW/TS3/*,+TSW/TAF/1 pkg_discounts_perm_list: close_in_day_limit: 0 close_in_discounts_perm_list: close_in_pkg_discounts_perm_list: far_out_day_limit: 0 far_out_discounts_perm_list: far_out_pkg_discounts_perm_list: comment: 2 rows in set (0.01 sec) and with LIMIT 1: *************************** 1. row *************************** promo_code: backend_system: nimax area_code: NMX venue_code: PLO/T event_code: 2649 perf_weekday: perf_yyyymmdd: perf_hhmm: perf_type_code: mod_group: standard_affiliate discounts_perm_list: +TSW/IL2/1 pkg_discounts_perm_list: close_in_day_limit: 0 close_in_discounts_perm_list: close_in_pkg_discounts_perm_list: far_out_day_limit: 0 far_out_discounts_perm_list: far_out_pkg_discounts_perm_list: comment: 1 row in set (0.00 sec) LIMIT 2 -> same result as without LIMIT
[25 Sep 2014 10:31]
Hartmut Holzgraefe
Explain plans are the same in both cases here, only differ in "rows" estimate (256 vs 287): *************************** 1. row *************************** id: 1 select_type: SIMPLE table: preferred_discounts_perm_lists type: index possible_keys: PRIMARY,backend_system key: PRIMARY key_len: 1399 ref: NULL rows: 287 Extra: Using where 1 row in set (0.00 sec)
[25 Sep 2014 10:33]
Hartmut Holzgraefe
even when adding FORCE INDEX (backend_system) I'm still getting the same results with and without LIMIT ...
[25 Sep 2014 15:08]
Pete French
Which version of FreeBSD are you using, and are you using the compiled version from the pkg repository ? This is perfectly repeatable for me on our systems. I haven't tried it on other versions of FreeBSD though. I will try and setup a separate test system elsewhere and see what results I get from that...
[26 Sep 2014 15:13]
Pete French
Ok, tried again this morning - I still have the bug on my table, but droping the table and reloading the data makes it behave correctly. Sorry! I assume that when I did the test of loading the data I forgot to switch to the fresh database before running the query. Still odd, but looks like a corrupt innodb table I guess. You can close this...
[26 Sep 2014 16:13]
MySQL Verification Team
Thank you for confirming, I couldn't repeat with 5.6.20/21 too. Per [26 Sep 15:13] Pete French, marking this as not a bug, please feel free to open if you are hitting this frequently. Thanks, Umesh