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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

subquery unnesting、Subquery unnesting and View Merge

發(fā)布時(shí)間:2025/3/15 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 subquery unnesting、Subquery unnesting and View Merge 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

本文內(nèi)容系轉(zhuǎn)載,如有侵犯你的知識(shí)產(chǎn)權(quán),煩請(qǐng)及時(shí)告知本人,本人將即刻停止侵權(quán)行為。

參考網(wǎng)址:http://space.itpub.net/27064837/viewspace-746501

     http://space.itpub.net/471666/viewspace-694608

? ? ? ? ? ? ? ? ??http://jonathanlewis.wordpress.com/2008/02/17/pushing-predicates-2/

? ? ? ? ? ? ? ? ??http://www.oraclefans.cn/forum/showtopic.jsp?rootid=6963

      ?http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10759/queries008.htm

1、Unnesting of Nested Subqueries

Unnesting of Nested Subqueries

Subqueries are?nested?when they appear in the?WHERE?clause of the parent statement. When Oracle Database evaluates a statement with a nested subquery, it must evaluate the subquery portion multiple times and may overlook some efficient access paths or joins.

Subquery unnesting?unnests and merges the body of the subquery into the body of the statement that contains it, allowing the optimizer to consider them together when evaluating access paths and joins. The optimizer can unnest most subqueries, with some exceptions. Those exceptions include hierarchical subqueries and subqueries that contain a?ROWNUM?pseudocolumn, one of the set operators, a nested aggregate function, or a correlated reference to a query block that is not the immediate outer query block of the subquery.

Assuming no restrictions exist, the optimizer automatically unnests some (but not all) of the following nested subqueries:

  • Uncorrelated?IN?subqueries

  • IN?and?EXISTS?correlated subqueries, as long as they do not contain aggregate functions or a?GROUP?BY?clause

You can enable?extended subquery unnesting?by instructing the optimizer to unnest additional types of subqueries:
? ? ? 1、 You can unnest an uncorrelated?NOT?IN?subquery by specifying the?HASH_AJ?or?MERGE_AJ?hint in the subquery.

? ? ? 2、You can unnest other subqueries by specifying the?UNNEST?hint in the subquery

對(duì)嵌套子查詢進(jìn)行解嵌套:

? ? ?當(dāng)子查詢出現(xiàn)在主查詢的where條件的時(shí)候,它們是嵌套的,當(dāng)Oracle對(duì)子查詢進(jìn)行驗(yàn)證的時(shí)候,需要多次的驗(yàn)證子查詢,并且要為其選擇一個(gè)高效的訪問路徑和連接方式。

? ?Subquery unnesting?將子查詢解套并且合并在包含他的主查詢的語句中,并且允許優(yōu)化器選擇訪問路徑和連接方式的時(shí)候,將他們放在一塊考慮,優(yōu)化器可以將大部分的嵌套查詢進(jìn)行轉(zhuǎn)換,除了一些特殊的,這些特殊情況包括:
層次查詢、包含偽列rownum的子查詢、聚合函數(shù)、不是主查詢的直接子查詢語句。

? ?可以使用Hint來指導(dǎo)優(yōu)化器來優(yōu)化如下的子查詢:

? ? 1、對(duì)于not in可以在子查詢中使用HASH_AJ或MERGE_AJ的hint

? ? 2、在子查詢中直接使用UNNEST

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/caroline/archive/2012/11/25/2787694.html

總結(jié)

以上是生活随笔為你收集整理的subquery unnesting、Subquery unnesting and View Merge的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。