Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Replacing GROUP BY with Sub-queries
Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1067473473.804043_at_yasure>...
> Thanks to both of you. I copied the sample too closely.
And if you really want the correct results as well as a jump in performance of nearly an order of magnitude, try this:
select
b.table_name,
(select count(1) from all_indexes a where a.table_name = b.table_name
and a.table_owner = b.owner) num_indexes
from all_tables b
<never assume object names are unique across "all*" views!>
;)
Cheers
Nuno Souto
wizofoz2k_at_yahoo.com.au.nospam
Received on Thu Oct 30 2003 - 00:40:45 CST