Re: Counting number of rows

  • From: "Juan Cachito Reyes Pacheco" <jreyes@xxxxxxxxxxxxxxxx>
  • To: <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 17 Feb 2004 17:10:52 -0400

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>


----- Original Message ----- 
From: "DENNIS WILLIAMS" <DWILLIAMS@xxxxxxxxxxxxx>
To: <oracle-l@xxxxxxxxxxxxx>
Sent: Tuesday, February 17, 2004 4:44 PM
Subject: RE: Counting number of rows


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@xxxxxxxxxxxxx

-----Original Message-----
From: Potluri, Venu (CT Appl Suppt) [mailto:venu_potluri@xxxxxx]
Sent: Tuesday, February 17, 2004 2:28 PM
To: oracle-l@xxxxxxxxxxxxx
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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //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@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------

Other related posts: