Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> how to tune up this query?
I have a 3 million records table. I want to retrieve the first 1000
records of the lowest number of priority. The query below is
extremely slow. I am suspecting it's because the subquery is
producing 200k records and it needs to sort the 200k records.
SELECT id, name, priority FROM
(SELECT id, name, priority FROM table_name
WHERE stage = 'start' and state = 1 ORDER BY stage ASC)
WHERE rownum <= 1000;
Is there any way to tune up this? Or should I write this query in another way?
Thanks,
Susan
Received on Wed Jan 29 2003 - 22:13:29 CST
![]() |
![]() |