日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle 计划中的view,执行计划里的view

發(fā)布時間:2025/4/5 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle 计划中的view,执行计划里的view 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓

FYI

Views

=====

When a view cannot be merged into the main query you will often see a

projection view operation. This indicates that the 'view' will be selected

from directly as opposed to being broken down into joins on the base tables.

A number of constructs make a view non mergeable. Inline views are also

non mergeable.

In the following example the select contains an inline view which cannot be

merged:

SQL> explain plan for

select ename,tot

from emp,

(select empno,sum(empno) tot from big_emp group by empno) tmp

where emp.empno = tmp.empno;

Query Plan

------------------------

SELECT STATEMENT [CHOOSE]

HASH JOIN

TABLE ACCESS FULL EMP [ANALYZED]

VIEW

SORT GROUP BY

INDEX FULL SCAN BE_IX

In this case the inline view tmp which contains an aggregate function cannot be

merged into the main query. The explain plan shows this as a view step.

Sometimes genreated VIEWs can be seen in the execution plan:

VIEW in the FROM clause (INLINE VIEW)

-------------------------------------

If a view cannot be merged into the main query then a VIEW keyword will

be shown in the plan to represent this.

explain plan for

select ename,tot

from emp,

(select empno x, sum(empno) tot from big_emp group by empno)

where emp.empno = x;

%ORACLE_HOME%/rdbms/admin/utlxpls.sql[This section is not visible to customers.]

7/17/13 Document 46234.1

https://mosemp.us.oracle.com/epmos/faces/ui/km/DocumentDisplay.jspx?_afrLoop=1561903930711194&id=46234.1&_afrWindowMode=0&_adf.ctrl-state=… 11/17

----------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |

----------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 16 | 720 | | 46 |

|* 1 | HASH JOIN | | 16 | 720 | | 46 |

| 2 | TABLE ACCESS FULL | EMP | 16 | 304 | | 1 |

| 3 | VIEW | | 10000 | 253K| | 44 |

| 4 | SORT GROUP BY | | 10000 | 30000 | 248K| 44 |

| 5 | TABLE ACCESS FULL| BIG_EMP | 10000 | 30000 | | 24 |

----------------------------------------------------------------------------

Predicate Information (identified by operation id):

---------------------------------------------------

1 - access("EMP"."EMPNO"="from$_subquery$_002"."X")

"from$_subquery$_002" is the generated name of the inline view that is

produced in id=3 line. If the inline view was aliased in the from clause then

the system generated name ("from$_subquery$_002") would be replaced by this

alias.

Subquery isunnested but resultant view is not merged:

-----------------------------------------------------

In preoptimization there is a stage where subqueries can be unnested (combined

with base query). There are numerous and complex ruled governing this activity

which are beyond the scope of this article. However, if successful, a subquery

may be unnested to produce an inline view which represents the subquery. This

view is subject to view merging. If the view is non-mergeable then a VIEW keyword

will appear in the plan.

explain plan for

select ename

from emp

where emp.empno in (select empno x from big_emp group by empno);

%ORACLE_HOME%/rdbms/admin/utlxpls.sql[This section is not visible to customers.]

----------------------------------------------------------------------------

| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |

----------------------------------------------------------------------------

| 0 | SELECT STATEMENT | | 16 | 512 | | 46 |

|* 1 | HASH JOIN SEMI | | 16 | 512 | | 46 |

| 2 | TABLE ACCESS FULL | EMP | 16 | 304 | | 1 |

| 3 | VIEW | VW_NSO_1 | 10000 | 126K| | 44 |

| 4 | SORT GROUP BY | | 10000 | 30000 | 248K| 44 |

| 5 | TABLE ACCESS FULL| BIG_EMP | 10000 | 30000 | | 24 |

----------------------------------------------------------------------------

Predicate Information (identified by operation id):

---------------------------------------------------

1 - access("EMP"."EMPNO"="VW_NSO_1"."X")

In this example, the subquery is unnested but the resultant inline view

cannot be merged due to the 'group by'. This unmergeable view is given the

system generated name of "VW_NSO_1".

Note: In later versions, as with any code, certain inline views may be mergeable following

code improvements or as new features are introduced.

總結

以上是生活随笔為你收集整理的oracle 计划中的view,执行计划里的view的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。