I have a table_A (C1,C2,C3,.....,Cn, datestamp)
Note : Column datestamp is indexed
QRY1
select * from
(select max(datestamp) dates from table_A) t,
table_A
where a.datestamp = t.dates
QRY2
select * from (
select a.* , max (datestamp) over() dates from table_A a))
where datestamp = dates
Explain Paln of QRY1 using indexed scan (execyted in 1 sec) cost was very less.
But for QRY2 going for full table scan (execyted in 8 sec) cost was very high.
Just wanted to know why analytical function ignores indexes.
Thanks (I am usig PL/SQL Oracle 10g)