| Bug #37964 | Wrong result using ORDER BY + LIMIT | ||
|---|---|---|---|
| Submitted: | 8 Jul 2008 11:17 | Modified: | 15 Jul 2008 9:56 |
| Reporter: | vsivak vsivak | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server: Optimizer | Severity: | S2 (Serious) |
| Version: | 5.1/5.0/6.0 | OS: | Any |
| Assigned to: | Georgi Kodinov | CPU Architecture: | Any |
| Tags: | ORDER BY DESC, regression | ||
[8 Jul 2008 11:17]
vsivak vsivak
[8 Jul 2008 13:47]
MySQL Verification Team
Thank you for the bug report. See Using Filesort on 5.0.41 and the lack of it on latest source.
C:\temp\mysql-5.0.41-win32>bin\mysql -uroot test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.41-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> SELECT * FROM videos WHERE video_categoriesid=1 ORDER BY id DESC LIMIT 2, 1\G
*************************** 1. row ***************************
id: 10
uid: 9798971171221584216471877
title: video 6
keywords:
description:
total_length: 15
videoscount: 1
resolution_w: 320
resolution_h: 240
time_added: 2008-04-07 21:44:34
images_last_rotation: 2008-07-01 00:00:01
images_rotation_timeout: 3600
sort_order: 0
selected: 0
enabled: 1
owner:
video_categoriesid: 1
1 row in set (0.00 sec)
mysql> EXPLAIN SELECT * FROM videos WHERE video_categoriesid=1 ORDER BY id DESC LIMIT 2, 1\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: videos
type: range
possible_keys: FKvideos758264
key: FKvideos758264
key_len: 4
ref: NULL
rows: 4
Extra: Using where; Using filesort
1 row in set (0.00 sec)
C:\dbs>c:\dbs\5.0\bin\mysql -uroot --port=3500 --prompt="mysql 5.0 > "
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.64-nt-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql 5.0 > use test2
Database changed
mysql 5.0 > SELECT * FROM videos WHERE video_categoriesid=1 ORDER BY id DESC LIMIT 2, 1\G
*************************** 1. row ***************************
id: 7
uid: 3566373516639909720539786
title: video 3
keywords:
description:
total_length: 15
videoscount: 1
resolution_w: 320
resolution_h: 240
time_added: 2008-04-07 21:44:27
images_last_rotation: 2008-07-01 00:00:01
images_rotation_timeout: 3600
sort_order: 0
selected: 0
enabled: 1
owner:
video_categoriesid: 1
1 row in set (0.00 sec)
mysql 5.0 > EXPLAIN SELECT * FROM videos WHERE video_categoriesid=1 ORDER BY id DESC LIMIT 2, 1\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: videos
type: range
possible_keys: FKvideos758264
key: FKvideos758264
key_len: 4
ref: NULL
rows: 4
Extra: Using where
1 row in set (0.00 sec)
mysql 5.0 >
[15 Jul 2008 9:56]
Georgi Kodinov
Duplicate of bug #37830
