Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: select count(*)
Yong wrote in message <8lsd65$rto$1_at_news.sinet.slb.com>...
>
>You probably remembered wrong. You seem to be talking about group by after
>the where clause. *That* will suppress an index scan.
Sigh .... c'mon guys, let's check our answers before we potentially mislead people. 5 minutes investigation reveals ...
select region, count(*)
from employees
where emp_id between 'P' and 'Q'
group by region
Rows Execution Plan
------- --------------------------------------------------- 0 SELECT STATEMENT GOAL: CHOOSE2864 SORT (GROUP BY)
OF 'EMPLOYEES' 4508 INDEX GOAL: ANALYZED (RANGE SCAN) OF 'EMPLOYEES$EMP_ID' (NON-UNIQUE)
However, I agree that the indexes are only used to *select* the rows for sorting and are not used in the sort/grouping operation itself.
(As before, example is from Oracle 8.1.5, but it applies to Oracle 7 too).
Dave.
-- If you reply to this posting by email, remove the "nospam" from my email address first.Received on Mon Jul 31 2000 - 00:00:00 CDT
![]() |
![]() |