Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> good guess for final record number in SELECT?

good guess for final record number in SELECT?

From: Volker Apelt <gq437x_at_yahoo.de>
Date: 26 Feb 2003 12:32:38 +0100
Message-ID: <lgd6lfl1k9.fsf@mu.biosolveit.local>

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                   
Received on Wed Feb 26 2003 - 05:32:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US