Thread: rownum filter prevents other predicates from being pushed into a view

This question is not answered. Helpful answers available: 5. Correct answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: May 4, 2009 11:33 AM Last Post By: SomeoneElse
Yoni Sade

Posts: 36
Registered: 11/18/02
rownum filter prevents other predicates from being pushed into a view
Posted: May 4, 2009 6:54 AM
 
Click to report abuse...   Click to reply to this thread Reply
I have a view:

create view all_alerts as
select 1 alert_level,alert_time,alert_details from alert_level_1
union all
select 2 alert_level,alert_time,alert_details from alert_level_2
union all
select 3 alert_level,alert_time,alert_details from alert_level_3;

when I query:

select * from (
select * from all_alerts where alert_level=3
order by alert_time desc);

it takes 5 seconds to get 1000 rows;

when I query to get the last 10 alerts:

select * from (
select * from my_view where alert_level=3
order by alert_time desc) where rownum<=10;

it takes 2 minutes (!);

It seems that the alert_level=3 predicate isn't being pushed into the view when the rownum is also there,
so all 3 tables are being queried.

I tried to use push_pred/merge hints but no luck.

Anyone?

Yoni

Edited by: yonim@acs.co.il on May 4, 2009 4:55 PM
Centinul

Posts: 3,249
Registered: 03/04/08
Re: rownum filter prevents other predicates from being pushed into a view
Posted: May 4, 2009 6:57 AM   in response to: Yoni Sade in response to: Yoni Sade
 
Click to report abuse...   Click to reply to this thread Reply
Can you please post the explain plans and predicate information output for each of the queries?
Yoni Sade

Posts: 36
Registered: 11/18/02
Re: rownum filter prevents other predicates from being pushed into a view
Posted: May 4, 2009 7:23 AM   in response to: Centinul in response to: Centinul
 
Click to report abuse...   Click to reply to this thread Reply
These sqls are just pseuds. Is there a reason for rownum<=x to make oracle not push the inner predicates?
Yoni Sade

Posts: 36
Registered: 11/18/02
Re: rownum filter prevents other predicates from being pushed into a view
Posted: May 4, 2009 11:25 AM   in response to: Yoni Sade in response to: Yoni Sade
 
Click to report abuse...   Click to reply to this thread Reply
This thread can be closed. Statistics were collected and the times are much better.
SomeoneElse

Posts: 9,551
Registered: 10/15/98
Re: rownum filter prevents other predicates from being pushed into a view
Posted: May 4, 2009 11:33 AM   in response to: Yoni Sade in response to: Yoni Sade
 
Click to report abuse...   Click to reply to this thread Reply
This thread can be closed.

You close your own threads here.
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums