[20151207]filter( IS NULL).txt
[20151207]filter( IS NULL).txt
--前一陣子別人問的問題,filter (IS NOT NULL)是什麼意思?
-- http://www.itpub.net/thread-1943880-1-1.html
--正好看劉工的影片"51CTO學院-Oracle效能最佳化精講影片課程【劉相兵】-ORACLE Maclean 的Oracle效能最佳化講座",找到如下
--語句,透過它來說明?
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SCOTT@book> alter session set statistics_level=all;
Session altered.
SELECT /*+ RULE to make sure it reproduces 100% */
ename
,job
,sal
,dname
FROM emp, dept
WHERE dept.deptno = emp.deptno
AND NOT EXISTS
(SELECT *
FROM salgrade
WHERE emp.sal BETWEEN losal AND hisal);
SCOTT@book> @ &r/dpcz
PLAN_TABLE_OUTPUT
-------------------------------------
SQL_ID anbbf4bvm5n5n, child number 0
-------------------------------------
SELECT /*+ RULE to make sure it reproduces 100% */ ename
,job ,sal ,dname FROM emp, dept WHERE dept.deptno =
emp.deptno AND NOT EXISTS (SELECT *
FROM salgrade WHERE emp.sal BETWEEN losal AND hisal)
Plan hash value: 243245009
-------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | A-Rows | A-Time | Buffers |
-------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 0 |00:00:00.01 | 109 |
|* 1 | FILTER | | 1 | 0 |00:00:00.01 | 109 |
| 2 | NESTED LOOPS | | 1 | 14 |00:00:00.01 | 25 |
| 3 | NESTED LOOPS | | 1 | 14 |00:00:00.01 | 11 |
| 4 | TABLE ACCESS FULL | EMP | 1 | 14 |00:00:00.01 | 7 |
|* 5 | INDEX UNIQUE SCAN | PK_DEPT | 14 | 14 |00:00:00.01 | 4 |
| 6 | TABLE ACCESS BY INDEX ROWID| DEPT | 14 | 14 |00:00:00.01 | 14 |
|* 7 | TABLE ACCESS FULL | SALGRADE | 12 | 12 |00:00:00.01 | 84 |
-------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1
4 - SEL$1 / EMP@SEL$1
5 - SEL$1 / DEPT@SEL$1
6 - SEL$1 / DEPT@SEL$1
7 - SEL$2 / SALGRADE@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter( IS NULL)
5 - access("DEPT"."DEPTNO"="EMP"."DEPTNO")
7 - filter(("HISAL">=:B1 AND "LOSAL"<=:B2))
Note
-----
- rule based optimizer used (consider using cbo)
--這裡的fliter ID=1條件是1 - filter( IS NULL).如果理解這個條件,就很好理解filter( IS NOT NULL)
SELECT /*+ RULE to make sure it reproduces 100% */
ename
,job
,sal
,dname
FROM emp, dept
WHERE dept.deptno = emp.deptno
AND EXISTS
(SELECT *
FROM salgrade
WHERE emp.sal BETWEEN losal AND hisal);
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1867919/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 了不起的 “filter(NULL IS NOT NULL)”FilterNull
- oracle全文索引之FILTER_1_NULL_FILTEROracle索引FilterNull
- [20151207]不斷應用日誌.txt應用日誌
- [20150727]''與NULL.txtNull
- [20170516]nvl與非NULL約束.txtNull
- [20121028]not in與NULL問題.txtNull
- ((NULL) null).printNULL();((NULL) null).printnull();Null
- [20180808]Null value to Dynamic SQL.txtNullSQL
- [20170516]nvl與非NULL約束2.txtNull
- [20160704]NULL與主外來鍵問題.txtNull
- [20141228]關於bloom filter.txtOOMFilter
- [20190612]NULL的資料型別.txtNull資料型別
- IS NULL和IS NOT NULLNull
- [20200317]NULL與排序輸出.txtNull排序
- [20170526]GLOBAL_NAME為NULL的修復2.txtNull
- not null與check is not nullNull
- [20231024]NULL值在索引的情況.txtNull索引
- [20160619]NULL在資料庫的儲存.txtNull資料庫
- [20140823]12c null與預設值.txtNull
- [20121028]IOT的第2索引-NULL的問題.txt索引Null
- [20180112]11g關閉bloom filter.txtOOMFilter
- MySQL中is not null和!=null和<>null的區別MySqlNull
- [20121020]主外來鍵約束以及NULL問題.txtNull
- 【NULL】Oracle null值介紹NullOracle
- mysql探究之null與not nullMySqlNull
- Difference between 2>&-, 2>/dev/null, |&, &>/dev/null, >/dev/null, 2>&1devNull
- [20200326]繫結變數抓取與NULL值.txt變數Null
- [20130301]clob欄位的empty_clob與NULL.txtNull
- MySQL案例-TIMESTAMP NOT NULL與NULLMySqlNull
- JavaScript filter()JavaScriptFilter
- Listener & FilterFilter
- jQuery filter()jQueryFilter
- Bag FilterFilter
- FILTER JOINFilter
- Utility FilterFilter
- Filter管道Filter
- gateway filterGatewayFilter
- MySQL中IS NULL、IS NOT NULL、!=不能用索引?胡扯!MySqlNull索引