Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: good guess for final record number in SELECT?
You could do an explain plan and Oracle might give you an estimate, but
otherwise no. You would have to count the records then retrieve trhe data
(which wil dramatically slow things down). See asktom.oracle.com for a
discussion of this.
Jim
-- Replace part of the email address: kennedy-down_with_spammers_at_attbi.com with family. Remove the negative part, keep the minus sign. You can figure it out. "Volker Apelt" <gq437x_at_yahoo.de> wrote in message news:lgd6lfl1k9.fsf_at_mu.biosolveit.local...Received on Wed Feb 26 2003 - 09:09:42 CST
>
> Short question:
> Is there some way to estimate the the row count for
> some SELECT statement already prepared and bound to a cursor
> without actually fetching all the rows?
>
> Oracle 9i, Linux, language Python
>
>
> Here is our problem:
>
> Given one possibly huge SELECT statement which is bound
> to a cursor. We did not fetch any row yet.
>
> A GUI Tool wants to present a good guess of the final row count
> to the end user.
>
> So, someone suggested to count the number of rows
> a certain huge SELECT will return by using
> 'SELECT COUNT(*) FROM (original-query)'
> before the 'original-query' is done and use that
> as the final correct row count.
>
> I guess the server will have to do 'original-query' twice
> and the count()ed row count will be just a guess,
> because of concurrent INSERT and DELETE operations.
> (we are working in READ COMMITTED)
>
> So, is there something significantly faster than
> COUNT()?
>
> Something like 'select ESTIMATE_COUNT(*) from (original-query)'?
>
> Thank you,
>
>
> Volker
>
>
> --
> Volker Apelt
>
>