DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: subselect vs. no subselect sql with analytical functions

Threaded View

  1. #1
    Join Date
    Apr 2007
    Posts
    31

    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
    Last edited by wakedba; 05-31-2007 at 11:37 AM. Reason: modified

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width