MySQL Forums
Forum List  »  Performance

how could this be?
Posted by: Nathan Cheng
Date: November 20, 2004 01:58PM

I have a query that looks like this:

SELECT ... ORDER BY primary_key_id LIMIT 0,50

The query in this form takes 7 seconds to run on our very powerful production machine. However, in this form

SELECT ... LIMIT 0,50

the query takes only 0.09 seconds to run. Even more baffling is this form:

SELECT ... ORDER BY primary_key_id

which takes only 0.3 seconds to run and returns only 150 rows, and this form:

SELECT ...

which takes about the same time (0.3 seconds).

How could this be? How could the first form take 7 FULL SECONDS, and the 3rd form be more than 70 times faster!!?? How could it take an otherwise idle dual processor Xeon with a fast RAID and 4GB RAM nearly 7 full seconds to select the first 50 rows from a 150-row result? This makes no sense!

We are running MySQL 4.1.7, though we had this same problem with 4.0.20, and perhaps even with 3.x (but I don't remember that far back).

Options: ReplyQuote


Subject
Views
Written By
Posted
how could this be?
3341
November 20, 2004 01:58PM
2365
November 21, 2004 02:33AM
2315
November 21, 2004 04:04PM
2367
November 21, 2004 04:16PM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.