Adding Order by slows query...
I have the following query that runs quickly (0.5 secs):
select ZipListMatrix.ZipListMatrixID, ZipListMatrix.ZipID, ZipListMatrix.CarrierRouteID,ZipListMatrix.ListID, ZipListMatrix.Quantity,List.DisplayOrder
from ZipListMatrix
join List
join UserList on List.ListID = UserList.ListID
on ZipListMatrix.ListID = List.ListID
where UserList.UserInfoID = 869
and ZipListMatrix.ZipID = 23112
order by ZipListMatrix.ZipID
But as soon as I change the order by to "order by ZipListMatrix.ZipID, ZipListMatrix.ListID" the query runs very slow (7.5 secs).
The table ZipListMatrix has 3.3 million records. I have indexes on ZipID, ListID
When I do an "explain"...I see the dreaded: Using Temporary, Using Filesort
Can anyone help? I don't know what to do to speed up the query!
Subject
Views
Written By
Posted
Adding Order by slows query...
5462
October 14, 2004 09:43AM
2720
October 14, 2004 09:53AM
2857
October 14, 2004 10:16AM
2784
October 15, 2004 08:37AM
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.