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

Home -> Community -> Usenet -> c.d.o.server -> Re: Total rows in table

Re: Total rows in table

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 03 Jan 2000 07:09:53 -0500
Message-ID: <p9417s00v0ai6rtajlu74vtd499d8cvtta@4ax.com>


A copy of this was sent to Alex Vinokur <alexander.vinokur_at_telrad.co.il> (if that email address didn't require changing) On Mon, 03 Jan 2000 11:23:47 GMT, you wrote:

>Using the following SQL command
> SELECT count (*) FROM MY_TABLE;
>we can get number of rows in MY_TABLE.
>
>Question. Is there another way to get this number?
>I tried to use the SQL command :
> SELECT NUM_ROWS FROM USER_TABLES WHERE TABLE_NAME='MY_TABLE';
>However, what I obtained is not number of rows in MY_TABLE.
>

num_rows in user_tables is populated when you analyze the table and compute/estimate statistics. It is a ball park number the optimizer will use to compute query costs across alternate plans. It is 'about' the number of rows in the table in general.

counting the rows with count() is the way to get the row count if you really really need it.

>
> Thanks in advance,
> Alex
>
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Jan 03 2000 - 06:09:53 CST

Original text of this message

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