Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Finding total Rows without count() ?
Brian Peasland wrote:
>
> > Of course it doesn't store that. Repeat after me - "Oracle is a relational
> > database". It would absolutely violate the concept of a relational database
> > if the number of rows in a table were stored anywhere. It wouldn't even
>
> Which concept of relational database theory is violated by storing or
> calculating the number of rows in a table?
>
Independence of data vs code. Is this something that isn't generally known? Only humans think in terms of actual numbers of rows. An RDBMS is blind to such things. Any limitations based on row counts is as the result of human limitations.
Believe me, I've worked with lame databases before I started working with Oracle. Back then everyone was concerned with the number of records in a dataset as well as header and trailer records. It was often a nightmare. I even knew situations where programmers had to physically change values in a program every two weeks when a particular payroll program was run because they didn't understand the concept of independence of code and data. Oracle was like a breath of fresh air.
> > make any sense. People need to get out of the old mode of thinking of a
>
> It makes sense to know the number of rows a table has. If you look in
> DBA_TABLES, there is a column called NUM_ROWS that gets populated when
> you analyze the table. The Optimizer makes use of this fact. Many DBAs
> find this number to be useful to them for certain situations.
That value is only as up-to-date as the last time that the table was analyzed. It is also primarily intended for use by the parser to determine execution path of a cursor. It is marginally useful to provide a ballpark figure but cannot be considered accurate at any given moment unless you know that the table is static - which is something that the database cannot know except when the table is in a tablespace that is read-only.
>
> HTH,
> Brian
Received on Wed Dec 15 1999 - 10:31:29 CST
![]() |
![]() |