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: Any way to get RowCount by not using Select count(*) from table

Re: Any way to get RowCount by not using Select count(*) from table

From: Jeremiah Wilton <jeremiah_at_wolfenet.com>
Date: Wed, 6 Jan 1999 07:33:10 -0800
Message-ID: <Pine.OSF.4.02.9901060727380.16621-100000@gonzo.wolfenet.com>


On Mon, 4 Jan 1999, Dan Morgan wrote:
>
> I know this is a segue but as a DBA I would really appreciate it if developers
> would STOP putting primary keys on EVERY table.
>
> For small static tables it takes twice as long for the SQL Engine to read the
> index and then read the table when a single read of the table would suffice.
> This same situation occurs in some cases with larger tables too. And this does
> not exactly enhance performance. If your concern is keeping the table in
> memory make it a cache table.

People need primary keys on tables to insure data integrity. It is true that in some cases the number of reads required to do an index full or range san may exceed the number of reads required to perform a full table scan. In these cases, a properly maintained database will produce the most efficient query plan based on the cost of the operations. The cost-based optimizer should automatically make the right decision in these cases. There is nothing wrong with primary keys.

--
Jeremiah Wilton http://www.wolfenet.com/~jeremiah Received on Wed Jan 06 1999 - 09:33:10 CST

Original text of this message

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