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
vslabs_at_onwe.co.za (Billy Verreynne) wrote in message news:<1a75df45.0310020119.25e06611_at_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.
I agree with you, but no one had directly answered the OP with this. You are highly encouraged to take large metal objects with a high polar moment of inertia to OEM and its vendor! :-)
One use of this hack could be with a select count to decide if it is time to re-analyse.
jg
-- @home.com is bogus. http://www.ttiinc.com/MarketEye/Aluminum_Cap_Issue.aspReceived on Tue Oct 07 2003 - 19:32:23 CDT