subselect vs. no subselect sql with analytical functions
The optimizer in the explain plan's cost and rows are the same for the two following queries however one is efficient (a) and the one using a subselect is extremely slow (b). Any ideas why this would occur, it seems like it's trying to satisfy the subselect before filtering it with a literal.
(a)
select * from (
select a.a, b.b, a.c, rank () over (partition by b.b order by a.c desc)
from a, b
where a.x=b.x
and a.x = 555)
(b)
select * from (
select a.a, b.b, a.c, rank () over (partition by b.b order by a.c desc)
from a, b
where a.x=b.x)
where x = 555