MySQL Forums
Forum List  »  Optimizer & Parser

Optimizing ORDER BY any ideas?
Posted by: Marc Van Olmen
Date: September 06, 2005 05:35PM

hi,

I have the following query:

select
PRY_EXPORT_CITY,
PRY_INDEX
from
T_PROPERTY,
T_SALES_ORDER_ITEM,
T_PROGRAM_PRODUCT
where
(SOI_LNK_PRODUCT NOT IN (7,8,9))
and (SOI_LNK_PRODUCT = PMP_LNK_PRODUCT)
and (PMP_LNK_CHANNEL = 1)
and (PMP_LNK_PROGRAM = 1)
and (PRY_LNK_SALES_ORDER_ITEM = SOI_INDEX)

This query takes 0.0039 seconds

When I add "ORDER BY PRY_EXPORT_CITY, PRY_INDEX"

it slows down to 0.3 seconds...

The query has a result of 5400 records. When I use explain select

Using where; Using index; Using temporary, using file sort

I indexed all fields, and also the fields used in ORDER BY

thanks for any thoughts,

mvo

Options: ReplyQuote


Subject
Views
Written By
Posted
Optimizing ORDER BY any ideas?
4558
September 06, 2005 05:35PM
2524
September 06, 2005 06:39PM
2697
September 06, 2005 08:30PM
2462
September 06, 2005 09:18PM
2454
September 07, 2005 07:10AM
2423
September 07, 2005 06:28PM
2467
September 07, 2005 08:55PM
2325
September 08, 2005 08:28AM
2375
September 08, 2005 11:12PM
2414
September 09, 2005 10:00AM
2353
September 09, 2005 10:22AM
2349
September 09, 2005 10:03PM
2558
September 10, 2005 07:30AM
2926
September 10, 2005 09:22AM
2350
September 12, 2005 02:45PM
2308
September 12, 2005 04:41PM


Sorry, you can't reply to this topic. It has been closed.

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.