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: What's fast way to get total of records

Re: What's fast way to get total of records

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: 2 Oct 2003 02:19:03 -0700
Message-ID: <1a75df45.0310020119.25e06611@posting.google.com>


joel-garry_at_home.com (Joel Garry) wrote
>
> /* OracleOEM */ SELECT to_char(last_analyzed,'DD-MON-YYYY
> HH24:MI'),blocks,empty_blocks,avg_space,num_rows,
> sample_size,avg_row_len,chain_cnt,avg_space_freelist_blocks,
> num_freelist_blocks from sys.dba_tables WHERE owner = 'SCOTT' AND
> table_name = 'EMP';

Joel, doing that is IMO very wrong.

If the app needs to know how many rows there are, then there's only one right and correct way. A select count. Shortcuts like the above are hacks that will only work after the analysis while the table remains constant. Sooner rather than later, this hack will bite the app's butt, chew it up and spit it out.

I have show numerous times in the news group that a select count does not need to be slow. If it is slow, then rather address that problem than to introduce a hack.

--
Billy
Received on Thu Oct 02 2003 - 04:19:03 CDT

Original text of this message

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