I just wanted to know how to interpret the explain plan:
explain plan for select count(*) from fot WHERE AGENCIA='edc' order by cod_doc desc;
| SELECT STATEMENT
| SORT AGGREGATE
TABLE ACCESS BY INDEX..
INDEX RANGE SCAN
the index created is desc.
Why do you need order by clause as the select only returns count?
Your explain plan says your table was scanned using an index, one or more rows were returned by using index rowid, and an aggreate was performed to return a single row for a group. A sort is a waste here since you are returning only count(*).
Remember the Golden Rule - He who has the gold makes the rules!
Ph.D., OCP 8i, 9i, 10g, 11g DBA
Click Here to Expand Forum to Full Width