Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> View vs Underlying Query Performance Question

View vs Underlying Query Performance Question

From: Soup <kjmerc5_at_gmail.com>
Date: 8 Sep 2006 05:25:15 -0700
Message-ID: <1157718315.050753.274140@d34g2000cwd.googlegroups.com>


I have a query that runs fast (second or less). I put this query into a view minus one condition (userid = '<the users userid>'). When I query the view and add the condition, the query (see 1 below) is slow (minutes). I tried running the view without the condition (see 2 below) and found that it ran in about the same amount of time and the explain plans were the same. The only difference was the results.

  1. SELECT * FROM myview WHERE userid = '<the users userid>'
  2. SELECT * FROM myview

Is this normal behavior? Doesn't Oracle include my condition before running the view's query? I assumed that since a view is a stored query that it would include my condition before processing the request. That isn't what is happening here. Also, I have used this approach before and haven't had an issue.

How should Oracle handle this situation? Will it always run the stored query first before narrowing the results by the conditions added outside of the view? If it should be including my condition what could prevent it from happening?

Thanks! Received on Fri Sep 08 2006 - 07:25:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US