Oracle query performance when filtering results
SELECT ident_account,ident_instrument,
        nvl(available, 0) + nvl(reserved, 0) + nvl(restrctd,0) AS total,
        nvl(available, 0) AS available,nvl(reserved, 0) AS reserved,nvl(restrctd, 0) AS restrctd,
        validfrom, minvaliduntil as validuntil
   FROM (
         SELECT h.ident_account, h.ident_instrument, h.validfrom, h.validuntil,
                rank() over(partition by h.ident_account, h.ident_instrument,IDENT_BALANCEGROUP order by h.validfrom desc) as rnk,
                sum(case when IDENT_BALANCEGROUP = 1 
                         then h.amount
                         else 0 end) over(partition by h.ident_account, h.ident_instrument,IDENT_BALANCEGROUP order by h.validfrom desc
                                          range between current row
                                                    and (nvl(validuntil,validfrom+1) - validfrom) following) as available,
                sum(case when IDENT_BALANCEGROUP = 2 
                         then h.amount
                         else 0 end) over(partition by h.ident_account, h.ident_instrument,IDENT_BALANCEGROUP order by h.validfrom desc
                                          range between current row
                                                    and (nvl(validuntil,validfrom+1) - validfrom) following) as reserved,
                sum(case when IDENT_BALANCEGROUP = 3
                         then h.amount
                         else 0 end) over(partition by h.ident_account, h.ident_instrument,IDENT_BALANCEGROUP order by h.validfrom desc
                                          range between current row
                                                    and (nvl(validuntil,validfrom+1) - validfrom) following) as restrctd,
                min(validuntil) over(partition by h.ident_account, h.ident_instrument order by h.validfrom desc
                                          range between current row
                                                    and (nvl(validuntil,validfrom+1) - validfrom) following) as minvaliduntil,
                h.amount,b.ident_balancegroup
           FROM holdings h INNER JOIN balancetype b ON h.ident_balancetype = b.ident_balancetype
        )
  WHERE rnk = 1;