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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Counting number of rows

Re: Counting number of rows

From: Juan Cachito Reyes Pacheco <jreyes_at_dazasoftware.com>
Date: Tue, 17 Feb 2004 17:10:52 -0400
Message-ID: <002501c3f59a$8c221b40$2501a8c0@dazasoftware.com>


What do you think about this?
SQL> select /*+ FIRST_ROWS(1) */ cts_cuenta from adm.cuentas_me where rownum=1;

Execution Plan


   0      SELECT STATEMENT Optimizer=HINT: FIRST_ROWS (Cost=2 Card=1 B
          ytes=11)

   1    0   COUNT (STOPKEY)
   2    1     INDEX (FULL SCAN) OF 'CST_CTS_CUENTA' (UNIQUE) (Cost=2 C
          ard=1 Bytes=11)





Statistics


         70  recursive calls
          0  db block gets
         22  consistent gets
          0  physical reads
          0  redo size
        252  bytes sent via SQL*Net to client
        417  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL> select count(*) from adm.cuentas_me;

Execution Plan


   0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1)    1 0 SORT (AGGREGATE)

   2    1     INDEX (FULL SCAN) OF 'IDX_CTS_CONTROL_PAGOS' (NON-UNIQUE
          ) (Cost=19 Card=16427)





Statistics


          0  recursive calls
          0  db block gets
         31  consistent gets
          0  physical reads
          0  redo size
        248  bytes sent via SQL*Net to client
        417  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          0  sorts (memory)
          0  sorts (disk)
          1  rows processed

SQL>

Venu

   Do you have any indexes on this table with NOT NULL? Count(*) will use index if there is a not-null index or a bitmapped index (nulls are incorporated in the bitmapped index).

Dennis Williams
DBA
Lifetouch, Inc.
dwilliams_at_lifetouch.com

-----Original Message-----

From: Potluri, Venu (CT Appl Suppt) [mailto:venu_potluri_at_ml.com] Sent: Tuesday, February 17, 2004 2:28 PM To: oracle-l_at_freelists.org
Subject: Counting number of rows

Is there a quick way to count number of rows in a table? Don't want to do select count(*) from..... on a table (such as GL_BALANCES) with more than 250 million rows.


If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/




==

If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it.

Click here for important additional terms relating to this e-mail.

     <http://www.ml.com/email_terms/>



==

Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html

-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line. -- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------
Received on Tue Feb 17 2004 - 15:10:52 CST

Original text of this message

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