Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: count(*)
Hi Rishi,
Oracle does not keep track of the total number of rows anywhere. When you need to do this, you need to issue a 'select count(*)...'. Note that unless ou are on a very old version of Oracle count(*), count(1), and count(pk_column) will do the same thing.
This is a design issue. You need to re-design your applicaiton to not require that count(*) every 10 minutes. You're right, it's killing you. And, as the tables continue to increase in size, this will NOT scale. You'll reach a point where the amount of time required to execute a count(*) exceeds the amount of time between calls to count(*). When that happens, it's all over. And, actually, even well before that happens, the frequency of the count(*) operation will severely limit your scalability.
Sorry I can't offer any better solutions.
Hope that helps,
-Mark
On Thu, 2002-09-19 at 14:28, Rishi.Jain_at_VerizonWireless.com wrote:
> Hi Gurus,
>
> In one of our insert intensive application we are inserting around 3-4
> million rows / hour. Also this app needs to do a count(*) of the tables
> every 10 minutes for verifying some application based logic. This is really
> killing us and it takes a lot of time.
>
> Can you please guide me to a direction ( built in functions or something
> similar).
>
> Actually this app is being ported from Informix. Informix can somehow keep a
> trak of the count(*) of a table in its header somewhere.
>
> And yes I have tries count(1) , count(indexed_column) etc.
>
>
> Thanks In Advance.
>
> R.h
-- -- Mark J. Bobak Oracle DBA mark_at_bobak.net "It is not enough to have a good mind. The main thing is to use it well." -- Rene Descartes -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Mark J. Bobak INET: mark_at_bobak.net Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Sep 19 2002 - 15:58:29 CDT