[20160314]關於sql寫法問題使用=還是用in
[20160314]關於sql寫法問題使用=還是用in.txt
--昨天看,我第一次看到的感覺應該可以轉化為連線查詢,順便做一個例子重複測試:
1.環境:
SCOTT@test01p> @ ver1
PORT_STRING VERSION BANNER CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0 12.1.0.1.0 Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0
SCOTT@book> create table t as select * from dba_objects ;
Table created.
SCOTT@book> create unique index pk_t on t(object_id);
Index created.
-- create index i_t_DATA_OBJECT_ID on t(DATA_OBJECT_ID);
--分析Method_Opt => 'FOR ALL COLUMNS SIZE 1 '。
2.測試:
SCOTT@book> alter session set statistics_level=all ;
Session altered.
SCOTT@test01p> select * from t where data_object_id = ( select data_object_id from t where object_id=40);
OWNER OBJECT_NAME SUBOBJECT_ OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NA SHARING E O
------ -------------------- ---------- ---------- -------------- ----------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ---------- ------------- - -
SYS I_OBJ5 40 40 INDEX 2013-06-28 09:03:29 2013-06-28 09:03:29 2013-06-28:09:03:29 VALID N N N 4 NONE Y
Plan hash value: 159606559
----------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
----------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.18 | 1546 | 1539 |
|* 1 | TABLE ACCESS FULL | T | 1 | 11 | 1265 | 429 (1)| 00:00:01 | 1 |00:00:00.18 | 1546 | 1539 |
| 2 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 |
|* 3 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 |
----------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T@SEL$1
2 - SEL$2 / T@SEL$2
3 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("DATA_OBJECT_ID"=)
3 - access("OBJECT_ID"=40)
--如果仔細看執行計劃,可以發現並不存在連線,執行計劃先選擇3->2->1.如果換成in:
SCOTT@test01p> select * from t where data_object_id in ( select data_object_id from t where object_id=40);
OWNER OBJECT_NAME SUBOBJECT_ OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NA SHARING E O
------ -------------------- ---------- ---------- -------------- ----------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ---------- ------------- - -
SYS I_OBJ5 40 40 INDEX 2013-06-28 09:03:29 2013-06-28 09:03:29 2013-06-28:09:03:29 VALID N N N 4 NONE Y
Plan hash value: 2201121422
----------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
----------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.18 | 1546 | 1539 |
| 1 | NESTED LOOPS | | 1 | 1 | 122 | 431 (1)| 00:00:01 | 1 |00:00:00.18 | 1546 | 1539 |
|* 2 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 |
|* 3 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 |
|* 4 | TABLE ACCESS FULL | T | 1 | 1 | 115 | 429 (1)| 00:00:01 | 1 |00:00:00.18 | 1543 | 1539 |
----------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$5DA710D3
2 - SEL$5DA710D3 / T@SEL$2
3 - SEL$5DA710D3 / T@SEL$2
4 - SEL$5DA710D3 / T@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("DATA_OBJECT_ID" IS NOT NULL)
3 - access("OBJECT_ID"=40)
4 - filter(("DATA_OBJECT_ID" IS NOT NULL AND "DATA_OBJECT_ID"="DATA_OBJECT_ID"))
--使用nested loop連線,作者認為不會出現連線查詢,如果看outline部分,可以發現使用in查詢時提示使用unnest,感覺作者使用錯提示.
--改寫如下:
select * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
Plan hash value: 2201121422
----------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
----------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.20 | 1546 | 1539 |
| 1 | NESTED LOOPS | | 1 | 1 | 122 | 431 (1)| 00:00:01 | 1 |00:00:00.20 | 1546 | 1539 |
|* 2 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 |
|* 3 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 |
|* 4 | TABLE ACCESS FULL | T | 1 | 1 | 115 | 429 (1)| 00:00:01 | 1 |00:00:00.20 | 1543 | 1539 |
----------------------------------------------------------------------------------------------------------------------------------------
--很明顯使用unnest提示後,執行計劃也可以改寫成連線查詢.甚至能交換次序.
select /*+ leading(t) */ * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
--執行計劃如下:
Plan hash value: 268617269
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.18 | 1545 | 1539 | | | |
|* 1 | HASH JOIN | | 1 | 1 | 122 | 431 (1)| 00:00:01 | 1 |00:00:00.18 | 1545 | 1539 | 1978K| 1092K| 2425K (0)|
|* 2 | TABLE ACCESS FULL | T | 1 | 8182 | 918K| 429 (1)| 00:00:01 | 8182 |00:00:00.15 | 1542 | 1539 | | | |
|* 3 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 | | | |
|* 4 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 | | | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.使用= 最大的問題是僅僅返回單行才行,多行才會報錯.
--改成非唯一索引看看.
drop index pk_t;
create index pk_t on t(object_id);
select * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
--檢視執行計劃:
Plan hash value: 145684969
------------------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.19 | 1546 | 1540 |
|* 1 | TABLE ACCESS FULL | T | 1 | 11 | 1265 | 429 (1)| 00:00:01 | 1 |00:00:00.19 | 1546 | 1540 |
| 2 | TABLE ACCESS BY INDEX ROWID BATCHED| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.02 | 3 | 1 |
|* 3 | INDEX RANGE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.02 | 2 | 1 |
------------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T@SEL$1
2 - SEL$2 / T@SEL$2
3 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("DATA_OBJECT_ID"=)
3 - access("OBJECT_ID"=40)
--可以看出這個問題關鍵在於查詢內層走的索引必須唯一,返回單行,這樣的查詢才可以轉換為連線查詢.如果不確定返回的行數,執行計劃
--不會採用連線查詢.
4.在使用10053看看:
drop index pk_t;
create unique index pk_t on t(object_id);
SCOTT@test01p> @ 10053on 12
Session altered.
SCOTT@test01p> Select * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
OWNER OBJECT_NAME SUBOBJECT_ OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NA SHARING E O
------ -------------------- ---------- ---------- -------------- ----------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ---------- ------------- - -
SYS I_OBJ5 40 40 INDEX 2013-06-28 09:03:29 2013-06-28 09:03:29 2013-06-28:09:03:29 VALID N N N 4 NONE Y
SCOTT@test01p> @ 10053off
Session altered.
Final query after transformations:******* UNPARSED QUERY IS *******
ELECT /*+ UNNEST */ "T"."OWNER" "OWNER","T"."OBJECT_NAME" "OBJECT_NAME","T"."SUBOBJECT_NAME"
"SUBOBJECT_NAME","T"."OBJECT_ID" "OBJECT_ID","T"."DATA_OBJECT_ID" "DATA_OBJECT_ID","T"."OBJECT_TYPE"
"OBJECT_TYPE","T"."CREATED" "CREATED","T"."LAST_DDL_TIME" "LAST_DDL_TIME","T"."TIMESTAMP" "TIMESTAMP","T"."STATUS"
"STATUS","T"."TEMPORARY" "TEMPORARY","T"."GENERATED" "GENERATED","T"."SECONDARY" "SECONDARY","T"."NAMESPACE"
"NAMESPACE","T"."EDITION_NAME" "EDITION_NAME","T"."SHARING" "SHARING","T"."EDITIONABLE"
"EDITIONABLE","T"."ORACLE_MAINTAINED" "ORACLE_MAINTAINED"
FROM "SCOTT"."T" "T","SCOTT"."T" "T"
WHERE "T"."DATA_OBJECT_ID" = "T"."DATA_OBJECT_ID"
AND "T"."OBJECT_ID" = 40
kkoqbc: optimizing query block SEL$841DDE77 (#1)
--可以發現最終查詢轉化為以上查詢.
--昨天看,我第一次看到的感覺應該可以轉化為連線查詢,順便做一個例子重複測試:
1.環境:
SCOTT@test01p> @ ver1
PORT_STRING VERSION BANNER CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0 12.1.0.1.0 Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0
SCOTT@book> create table t as select * from dba_objects ;
Table created.
SCOTT@book> create unique index pk_t on t(object_id);
Index created.
-- create index i_t_DATA_OBJECT_ID on t(DATA_OBJECT_ID);
--分析Method_Opt => 'FOR ALL COLUMNS SIZE 1 '。
2.測試:
SCOTT@book> alter session set statistics_level=all ;
Session altered.
SCOTT@test01p> select * from t where data_object_id = ( select data_object_id from t where object_id=40);
OWNER OBJECT_NAME SUBOBJECT_ OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NA SHARING E O
------ -------------------- ---------- ---------- -------------- ----------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ---------- ------------- - -
SYS I_OBJ5 40 40 INDEX 2013-06-28 09:03:29 2013-06-28 09:03:29 2013-06-28:09:03:29 VALID N N N 4 NONE Y
Plan hash value: 159606559
----------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
----------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.18 | 1546 | 1539 |
|* 1 | TABLE ACCESS FULL | T | 1 | 11 | 1265 | 429 (1)| 00:00:01 | 1 |00:00:00.18 | 1546 | 1539 |
| 2 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 |
|* 3 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 |
----------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T@SEL$1
2 - SEL$2 / T@SEL$2
3 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("DATA_OBJECT_ID"=)
3 - access("OBJECT_ID"=40)
--如果仔細看執行計劃,可以發現並不存在連線,執行計劃先選擇3->2->1.如果換成in:
SCOTT@test01p> select * from t where data_object_id in ( select data_object_id from t where object_id=40);
OWNER OBJECT_NAME SUBOBJECT_ OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NA SHARING E O
------ -------------------- ---------- ---------- -------------- ----------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ---------- ------------- - -
SYS I_OBJ5 40 40 INDEX 2013-06-28 09:03:29 2013-06-28 09:03:29 2013-06-28:09:03:29 VALID N N N 4 NONE Y
Plan hash value: 2201121422
----------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
----------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.18 | 1546 | 1539 |
| 1 | NESTED LOOPS | | 1 | 1 | 122 | 431 (1)| 00:00:01 | 1 |00:00:00.18 | 1546 | 1539 |
|* 2 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 |
|* 3 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 |
|* 4 | TABLE ACCESS FULL | T | 1 | 1 | 115 | 429 (1)| 00:00:01 | 1 |00:00:00.18 | 1543 | 1539 |
----------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$5DA710D3
2 - SEL$5DA710D3 / T@SEL$2
3 - SEL$5DA710D3 / T@SEL$2
4 - SEL$5DA710D3 / T@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("DATA_OBJECT_ID" IS NOT NULL)
3 - access("OBJECT_ID"=40)
4 - filter(("DATA_OBJECT_ID" IS NOT NULL AND "DATA_OBJECT_ID"="DATA_OBJECT_ID"))
--使用nested loop連線,作者認為不會出現連線查詢,如果看outline部分,可以發現使用in查詢時提示使用unnest,感覺作者使用錯提示.
--改寫如下:
select * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
Plan hash value: 2201121422
----------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
----------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.20 | 1546 | 1539 |
| 1 | NESTED LOOPS | | 1 | 1 | 122 | 431 (1)| 00:00:01 | 1 |00:00:00.20 | 1546 | 1539 |
|* 2 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 |
|* 3 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 |
|* 4 | TABLE ACCESS FULL | T | 1 | 1 | 115 | 429 (1)| 00:00:01 | 1 |00:00:00.20 | 1543 | 1539 |
----------------------------------------------------------------------------------------------------------------------------------------
--很明顯使用unnest提示後,執行計劃也可以改寫成連線查詢.甚至能交換次序.
select /*+ leading(t) */ * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
--執行計劃如下:
Plan hash value: 268617269
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads | OMem | 1Mem | Used-Mem |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.18 | 1545 | 1539 | | | |
|* 1 | HASH JOIN | | 1 | 1 | 122 | 431 (1)| 00:00:01 | 1 |00:00:00.18 | 1545 | 1539 | 1978K| 1092K| 2425K (0)|
|* 2 | TABLE ACCESS FULL | T | 1 | 8182 | 918K| 429 (1)| 00:00:01 | 8182 |00:00:00.15 | 1542 | 1539 | | | |
|* 3 | TABLE ACCESS BY INDEX ROWID| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.01 | 3 | 0 | | | |
|* 4 | INDEX UNIQUE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.01 | 2 | 0 | | | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.使用= 最大的問題是僅僅返回單行才行,多行才會報錯.
--改成非唯一索引看看.
drop index pk_t;
create index pk_t on t(object_id);
select * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
--檢視執行計劃:
Plan hash value: 145684969
------------------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time | A-Rows | A-Time | Buffers | Reads |
------------------------------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | | | 431 (100)| | 1 |00:00:00.19 | 1546 | 1540 |
|* 1 | TABLE ACCESS FULL | T | 1 | 11 | 1265 | 429 (1)| 00:00:01 | 1 |00:00:00.19 | 1546 | 1540 |
| 2 | TABLE ACCESS BY INDEX ROWID BATCHED| T | 1 | 1 | 7 | 2 (0)| 00:00:01 | 1 |00:00:00.02 | 3 | 1 |
|* 3 | INDEX RANGE SCAN | PK_T | 1 | 1 | | 1 (0)| 00:00:01 | 1 |00:00:00.02 | 2 | 1 |
------------------------------------------------------------------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1 / T@SEL$1
2 - SEL$2 / T@SEL$2
3 - SEL$2 / T@SEL$2
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("DATA_OBJECT_ID"=)
3 - access("OBJECT_ID"=40)
--可以看出這個問題關鍵在於查詢內層走的索引必須唯一,返回單行,這樣的查詢才可以轉換為連線查詢.如果不確定返回的行數,執行計劃
--不會採用連線查詢.
4.在使用10053看看:
drop index pk_t;
create unique index pk_t on t(object_id);
SCOTT@test01p> @ 10053on 12
Session altered.
SCOTT@test01p> Select * from t where data_object_id = ( select /*+ unnest */ data_object_id from t where object_id=40);
OWNER OBJECT_NAME SUBOBJECT_ OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED LAST_DDL_TIME TIMESTAMP STATUS T G S NAMESPACE EDITION_NA SHARING E O
------ -------------------- ---------- ---------- -------------- ----------------------- ------------------- ------------------- ------------------- ------- - - - ---------- ---------- ------------- - -
SYS I_OBJ5 40 40 INDEX 2013-06-28 09:03:29 2013-06-28 09:03:29 2013-06-28:09:03:29 VALID N N N 4 NONE Y
SCOTT@test01p> @ 10053off
Session altered.
Final query after transformations:******* UNPARSED QUERY IS *******
ELECT /*+ UNNEST */ "T"."OWNER" "OWNER","T"."OBJECT_NAME" "OBJECT_NAME","T"."SUBOBJECT_NAME"
"SUBOBJECT_NAME","T"."OBJECT_ID" "OBJECT_ID","T"."DATA_OBJECT_ID" "DATA_OBJECT_ID","T"."OBJECT_TYPE"
"OBJECT_TYPE","T"."CREATED" "CREATED","T"."LAST_DDL_TIME" "LAST_DDL_TIME","T"."TIMESTAMP" "TIMESTAMP","T"."STATUS"
"STATUS","T"."TEMPORARY" "TEMPORARY","T"."GENERATED" "GENERATED","T"."SECONDARY" "SECONDARY","T"."NAMESPACE"
"NAMESPACE","T"."EDITION_NAME" "EDITION_NAME","T"."SHARING" "SHARING","T"."EDITIONABLE"
"EDITIONABLE","T"."ORACLE_MAINTAINED" "ORACLE_MAINTAINED"
FROM "SCOTT"."T" "T","SCOTT"."T" "T"
WHERE "T"."DATA_OBJECT_ID" = "T"."DATA_OBJECT_ID"
AND "T"."OBJECT_ID" = 40
kkoqbc: optimizing query block SEL$841DDE77 (#1)
--可以發現最終查詢轉化為以上查詢.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2057288/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 轉賬問題是屬於業務問題還是屬於技術問題?
- JAVA關於判斷年份是閏年還是平年的問題Java
- 關於號段選取的sql寫法SQL
- 關於SQL Server的記憶體佔用問題SQLServer記憶體
- 關於寫作那些事之終於還是無法忍受純人工統計資料
- 關於delete還是update會產生更多日誌的問題delete
- 關於工作當中系統引擎到底是用手寫還是用類似yacc工具編寫?
- 關於Qt無法直接使用cout和cin的問題QT
- 標準SQL寫法的重複列問題SQL
- 關於MQTT 使用遇到問題MQQT
- 關於IDEA使用xml實現動態sql的問題IdeaXMLSQL
- 關於SQL的重複記錄問題SQL
- 關於excelize庫的使用問題Excelize
- 問一個關於SSH整合是在action中應用session的問題Session
- 關於sql語句的遊標共享問題SQL
- 關於auto increment的寫法REM
- 關於 Google 電子表格無法訪問的問題Go
- 複雜查詢還是直接寫sql吧SQL
- 致板橋:關於"查詢資料庫後是返回ResultSet還是返回Collection?"的幾點問題資料庫
- 健康還是工作,這是個問題
- javascript,還是javascript的問題JavaScript
- 關於docker無法訪問倉庫的映象代理問題Docker
- 關於我寫的工廠模式的奇怪問題??模式
- [SQL]關於Concatenated Groupings的問題[轉載]SQL
- 關於STM8的使用者資料空間讀寫問題
- 爭用!!!!一個關於JDBC的問題!JDBC
- 關於用硬碟安裝LINUX的問題硬碟
- 關於listener無法啟動的問題解決
- 關於非簇索引中儲存的簇索引的RID還是指標的問題索引指標
- 轉: 關於oracle 是按照寫入順序還是ROWID順序取資料Oracle
- 大衛談學習3:方法還是問題,這是個問題!
- 【調優】設計問題還是優化問題?優化
- Spring的問題,還是Tomcat的問題SpringTomcat
- 關於FastHashMap問題ASTHashMap
- Redisson-關於使用訂閱數問題Redis
- 關於使用擴充套件包的問題。套件
- sql server 資料庫還原問題SQLServer資料庫
- SQL -- 使用聯結還是子查詢?SQL