Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: rownum=1 slow + tell if a column has at least a non null value
On 13 Nov 2002, scjm_at_noos.fr wrote:
> Hello,
>
> I run these queries with toad on my_table (25 millions rows) :
>
> select count(*) from my_table where rownum = 1;
> => 8s
>
> select count(*) from my_table where rownum < 3000000;
> => 30s
>
> select count(*) from my_table where rownum < 30000000;
> => 4 min
>
> 1) Why does it take 8 sec for the first to complete ?
> I thought it would be instantaneous.
The rownum operator is applied to the output of a query. Oracle checks invokes that restriction before returning the result set.
> (select * from my_table where key='value' is instantaneous)
I'm sure there is some index on key.
-- Galen BoyerReceived on Wed Nov 13 2002 - 13:42:08 CST