Partition pruning
improves response time by a factor of 18,000!
This blog notes a fascinating tuning
approach whereby the blogger got a query down from one
hours to .02 seconds, and 18,000 improvement:
http://oraclesponge.blogspot.com/2006/03/predicate-pushing-and-analytic.html
He notes how he got his spectacular results:
"Queries that access this view had
predicates on a number of columns, including some very
selective indexed columns (Item_ID) and a partition key column
(Fiscal_Month). Unfortunately there is nothing in the database
to tell the optimizer that each unique value of Transaction_ID
had but a single value Item_ID and Fiscal_Month, so logically
the predicates could not be applied until after the analytic
function had been calculated.
Hence there was no predicate
pushing on the fiscal_month and item_id, and neither partition
pruning nor index access was considered. The query was
actually scanning about one quarter of the table (it looks
like a combination of subpartition pruning and partition
pruning was taking place, but this table is multicolumn range
+ list composite partitioned, and pruning at the partition
level was only taking place on the leading column of the
partition key).
However, we included the two predicate columns in the analytic
functions' partition clause like so:
Decode(Row_Number() Over (Partition By
Transaction_ID, Item_Id, Fiscal_Month Order By 1),1,Qty,0)
Now this doesn't change the result because the Item_Id and
Fiscal_Month entries are actually logically redundant, but it
did allow both 9i and 10g to push the predicates and give full
partition and subpartition pruning and index-based access."