Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to tune up this query?
I'd have to see the explain plan to be convinced.
Perhaps an alternative strategum of keeping things in order as tehy are inserted and modified by means of triggers. Of course, the real answer lies in the ration of writes : reads.
I have just noticed that the "order by stage" is completely redundant anyway, as the query specifies only one value for "stage"! (Probably a mis-type, I suppose).
Regards,
ETA.
"Richard Foote" <richard.foote_at_bigpond.com> wrote in message news:<bt9_9.36755$jM5.93743_at_newsfeeds.bigpond.com>...
> "Ethel Aardvark" <bigjobbies_at_hotmail.com> wrote in message
> news:1a8fec49.0301300505.46e10f1b_at_posting.google.com...
> > Susan,
> > Without trying it, could this not be re-written as follows:
> >
> > SELECT id, name, priority FROM table_name
> > WHERE stage = 'start' and state = 1
> > AND rownum <= 1000
> > ORDER BY stage ASC
> >
> > Remember that rownun is treated differently from other fields and will
> > not be applied until AFTER the sort has taken place.
> >
>
> Hi Ethel,
>
> True, but the sort as a result is potentially going to be one big mamma.
>
> See my previous post why your code is less efficient than Susan's.
>
> Cheers
>
> Richard
Received on Tue Feb 04 2003 - 03:09:04 CST
![]() |
![]() |