Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>WOW!! This is interesting.. I have two different explain plan depends on different data volumn &amp; query inside logical view(This is my assumption)</p> <ol> <li>The original question case : It is definitely doing filtering first. I have small number of data(&lt;10 in total) in this test table. <pre><code> ` | 0 | SELECT STATEMENT | | 2 | 132 | 2 (0)| 00:00:01 | | 1 | NESTED LOOPS | | 2 | 132 | 2 (0)| 00:00:01 | | 2 | TABLE ACCESS BY INDEX ROWID| PERSON | 1 | 40 | 1 (0)| 00:00:01 | |* 3 | INDEX UNIQUE SCAN | PERSON_PK | 1 | | 0 (0)| 00:00:01 | |* 4 | INDEX RANGE SCAN | ORDERS_PK | 2 | 52 | 1 (0)| 00:00:01 | Predicate Information (identified by operation id) 3 - access("P"."P_ID"=1) 4 - access("O"."P_ID"=1) Note <ul> <li>dynamic sampling used for this statement ` </code></pre></li> </ul></li> <li>However, when the data become larger(just several hundreads though, 300 ~ 400) and the view query become complex(using "connect by" etc..), the plan changed, I think...</li> </ol> <pre> | 0 | SELECT STATEMENT | | 1 | 29 | 2 (0)| 00:00:01 | | 1 | NESTED LOOPS | | 1 | 29 | 2 (0)| 00:00:01 | | 2 | TABLE ACCESS BY INDEX ROWID| RP_TRANSACTION | 1 | 12 | 1 (0)| 00:00:01 | |* 3 | INDEX UNIQUE SCAN | RP_TRANSACTION_PK | 1 | | 0 (0)| 00:00:01 | | 4 | TABLE ACCESS BY INDEX ROWID| RP_REQUEST | 279 | 4743 | 1 (0)| 00:00:01 | |* 5 | INDEX UNIQUE SCAN | RP_REQUEST_PK | 1 | | 0 (0)| 00:00:01 | Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("TRANSACTION_ID"=18516648) 5 - access("REQ"."REQUEST_ID"="TRANS"."REQUEST_ID") </pre> <p>---- Below is my original post</p> <p>In my knowledge, the oracle first execute the view(logical view) using temporary space and then do the filter.. So your query is basically same as </p> <p>SELECT *<br> FROM ( SELECT *<br> FROM PERSON P, ORDERS O WHERE P.P_ID = O.P_ID ) where P_ID='1234'</p> <p>I don't think you can create index on logical view(Materialized view uses index)</p> <p>Also, you should be aware, you would execute the query for MY_VIEW, everytime you using select * from MY_VIEW where P_ID = '1234'.</p> <p>I mean every single time. Naturally, it is not a good idea for the performance matter</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload