對fiter操作的解釋。
SQL> SELECT /*+ gather_plan_statistics */ *
2 FROM emp
3 WHERE NOT EXISTS (SELECT /*+ no_unnest */ 0
4 FROM dept
5 WHERE dept.dname = 'SALES' AND dept.deptno = emp.deptno)
6 AND NOT EXISTS (SELECT /*+ no_unnest */ 0
7 FROM bonus
8 WHERE bonus.ename = emp.ename);
SQL> select * from table(dbms_xplan.display_cursor(null,null,'iostats last'));
--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
--------------------------------------------------------------------------------------------------
|* 1 | FILTER | | 1 | | 8 |00:00:00.01 | 35 |
| 2 | TABLE ACCESS FULL | EMP | 1 | 14 | 14 |00:00:00.01 | 8 |
|* 3 | TABLE ACCESS BY INDEX ROWID| DEPT | 3 | 1 | 1 |00:00:00.01 | 6 |
|* 4 | INDEX UNIQUE SCAN | PK_DEPT | 3 | 1 | 3 |00:00:00.01 | 3 |
|* 5 | TABLE ACCESS FULL | BONUS | 7 | 1 | 0 |00:00:00.01 | 21 |
--------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter( NOT EXISTS (SELECT 0 FROM "DEPT" "DEPT" WHERE "DEPT"."DEPTNO"=:B1
AND "DEPT"."DNAME"='SALES') AND NOT EXISTS (SELECT 0 FROM "BONUS"
"BONUS" WHERE "BONUS"."ENAME"=:B2))
3 - filter("DEPT"."DNAME"='SALES')
4 - access("DEPT"."DEPTNO"=:B1)
5 - filter("BONUS"."ENAME"=:B1)
The particular characteristic of this operation is that it supports a varying number of children.
If it has a single child, it is considered a stand-alone operation. If it has two or more children,
its function is similar to the operation NESTED LOOPS. The first child drives the execution of the
other children.------------摘錄自 troubleshooting oracle performance
1.首先操作2先執行,返回14條記錄給父操作1.
2.操作2返回的每條記錄,過濾操作的第二和第三個孩子都要執行一次。In reality, a kind of caching is implemented to reduce executions to a minimum. This is confirmed by comparing the column A-Rows of operation 2 with the column Starts of operations 3 and 5. Operation 3 is executed three times, once for each distinct value in the column deptno in the table emp. Operation 5 is executed eight times, once for each distinct value in the column empno in the table emp after applying the filter imposed by the operation 3.---英文部分摘錄自troubleshooting oracle performance。我認為紅色字型為書中的錯誤,應該是經過操作3過濾後,emp表的ename欄位有幾個不同值就執行幾次,而不是empno有幾個不同值就執行幾次。
3.According to the rules for stand-alone operations, operation 4, which is executed before operation 3, scans the index dept_pk by applying the access predicate "DEPT"."DEPTNO"=:B1. The bind variable (B1) is used to pass the value that is to be checked by the subquery. By doing so over the three executions, it extracts three rowids from the index and passes them to its parent operation (3).
4. Operation 3 accesses the table dept through the rowids passed from its child operation(4) and applies the filter predicate "DEPT"."DNAME"='SALES'. Since this operation is used only to apply a restriction, it returns no data to its parent operation (1). In any case, it is important to note that only one row satisfying the filter predicate was found. Since a NOT EXISTS is used, this matching row is discarded.
5. Operation 5 scans the table bonus and applies the filter predicate "BONUS"."ENAME"=:B1. The bind variable (B1) is used to pass the value to be checked by the subquery. Since this operation is used only to apply a restriction, it returns no data to its parent operation (1). It is, however, important to notice that no row satisfying the filter predicate was found. Since a NOT EXISTS is used, no rows are discarded.
6. Operation 1, after applying the filter predicate implemented with operations 3 and 5, sends the data of eight rows to the caller.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-672064/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 對MarshalByRefObject的解釋Object
- 五、對Linux中使用者的詳細解釋及操作Linux
- PHP對redis操作詳解[轉]PHPRedis
- Java對各種檔案的操作詳解Java
- Oracle對於物件名的解釋順序Oracle物件
- Oracle對RAC gsd服務作用的解釋Oracle
- Bash 單命令列解釋(2)--字串操作命令列字串
- 對Oracle效能統計中的資料解釋Oracle
- parallel並行度的相關操作、概念、引數解釋Parallel並行
- Bash 單命令列解釋(1)--檔案操作命令列
- jquery對table的操作jQuery
- 對陣列的操作陣列
- java對cookie的操作JavaCookie
- 1.對Java平臺的理解。“Java是解釋執行”對嗎Java
- 對超執行緒幾個不同角度的解釋執行緒
- 對類物件的方法操作物件
- JSOM 對User的操作JS
- 對線性表的操作
- Oracle SQL對錶的操作OracleSQL
- 記憶體對齊巨集定義的簡明解釋記憶體
- 利用IE6對!important的解釋差異做HackImport
- 幾個非常經典的對“資料倉儲”的解釋(ZT)
- NSIS 官方對安裝包出現 NSIS Error 的解釋與解決方案Error
- 論文分享:用於模型解釋的對抗不忠學習模型
- PHP 對 Redis key 值的操作PHPRedis
- Python對excel的基本操作PythonExcel
- python對檔案的操作Python
- Android 對SD卡的操作AndroidSD卡
- 對錶列的基礎操作
- JQuery 對 Select option 的操作jQuery
- JavaScript中對陣列的操作JavaScript陣列
- shrink 操作對索引的影響索引
- 多對多的操作問題
- Update操作對索引的影響索引
- django 模板語言的註釋操作Django
- epoll的解釋
- [譯] React 16 帶來了什麼以及對 Fiber 的解釋React
- 對含distinct操作的SQL的優化SQL優化