| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: What's fast way to get total of records
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.
-- BillyReceived on Thu Oct 02 2003 - 04:19:03 CDT
![]() |
![]() |