【sql調優之執行計劃】temp table transformation
使用系統臨時表的時候,執行計劃會有個TEMP TABLE TRANSFORMATION的operation,可以叫做臨時錶轉化,看一個具體的例子,使用hint:/*+ materialize */來強制讓oracle建立臨時表。
SQL> with temp as
2 (
3 select /*+ materialize */
4 a.* from scott.emp a,scott.dept b
5 where a.deptno = b.deptno
6 and a.empno = 7369
7 )
8 select count(*) from temp a ;
COUNT(*)
----------
1
Execution Plan
----------------------------------------------------------
Plan hash value: 555904337
--------------------------------------------------------------------------------
-----------------------------
| Id | Operation | Name | Rows | By
tes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
-----------------------------
| 0 | SELECT STATEMENT | | 1 |
| 3 (0)| 00:00:01 |
| 1 | TEMP TABLE TRANSFORMATION | | |
| | |
| 2 | LOAD AS SELECT | | |
| | |
|* 3 | TABLE ACCESS BY INDEX ROWID| EMP | 1 |
39 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | PK_EMP | 1 |
| 0 (0)| 00:00:01 |
| 5 | SORT AGGREGATE | | 1 |
| | |
| 6 | VIEW | | 1 |
| 2 (0)| 00:00:01 |
| 7 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6613_A0A5C4A5 | 1 |
39 | 2 (0)| 00:00:01 |
--------------------------------------------------------------------------------
-----------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - filter("A"."DEPTNO" IS NOT NULL)
4 - access("A"."EMPNO"=7369)
Statistics
----------------------------------------------------------
222 recursive calls
10 db block gets
30 consistent gets
1 physical reads
1652 redo size
411 bytes sent via SQL*Net to client
400 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
可以找到系統建立這個臨時表的sql:
SQL> select sql_text from v$sqltext a where a.SQL_ID = 'aamnajt3sq3zt' order by a.PIECE;
SQL_TEXT
----------------------------------------------------------------
CREATE GLOBAL TEMPORARY TABLE "SYS"."SYS_TEMP_0FD9D660E_A0A5C4A5
" ("C0" NUMBER(4),"C1" VARCHAR2(10),"C2" VARCHAR2(9),"C3" NUMBER
(4),"C4" DATE,"C5" NUMBER(10,2),"C6" NUMBER(10,2),"C7" NUMBER(2)
) IN_MEMORY_METADATA CURSOR_SPECIFIC_SEGMENT STORAGE (OBJNO 425
4950926 ) NOPARALLEL
這裡可以看到這個系統臨時表存放在記憶體中,使用的是create global temporary語句建立。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16179598/viewspace-671190/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【sql調優之執行計劃】獲取執行計劃SQL
- 【sql調優之執行計劃】sort operationsSQL
- 【sql調優之執行計劃】estimator iSQL
- 【sql調優之執行計劃】hash joinSQL
- 【sql調優之執行計劃】query transformerSQLORM
- 【sql調優之執行計劃】in相關的operationSQL
- 【sql調優之執行計劃】merge sort joinSQL
- 【sql調優之執行計劃】使用hint(五)Hint for parallelSQLParallel
- 【sql調優之執行計劃】使用hint(四)Hints for JoinSQL
- mysql調優之——執行計劃explainMySqlAI
- 【sql調優之執行計劃】使用hint(三)Hints for Query TransformationsSQLORM
- 【sql調優之執行計劃】使用hint(二)Hints for Access PathsSQL
- Oracle調優之看懂Oracle執行計劃Oracle
- 【sql調優之執行計劃】使用hint(六) append and noappendSQLAPP
- 【sql調優之執行計劃】merge join cartesian and buffer sortSQL
- 【sql調優之執行計劃】使用hint(一)Hints for Optimization Approaches and GoalsSQLAPPGo
- 【sql調優之執行計劃】merge semi join and merge anti joinSQL
- 【sql調優之執行計劃】nested loops join and nested loop join outerSQLOOP
- 建立索引調整sql的執行計劃索引SQL
- oracle筆記整理14——效能調優之oracle執行計劃Oracle筆記
- Oracle中SQL調優(SQL TUNING)之最權威獲取SQL執行計劃大全OracleSQL
- 控制執行計劃之-SQL Profile(一)SQL
- sql 執行計劃SQL
- Oracle+高效能SQL引擎剖析:SQL優化與調優機制詳解-筆記之執行計劃(一)OracleSQL優化筆記
- Oracle+高效能SQL引擎剖析:SQL優化與調優機制詳解-筆記之執行計劃(二)OracleSQL優化筆記
- ORACLE SQL調優之執行計劃與隱藏引數_complex_view_mergingOracleSQLView
- ORACLE SQL調優之'PLAN_TABLE' is old versionOracleSQL
- 使用leading(,)優化sql執行計劃優化SQL
- MySQL調優篇 | EXPLAIN執行計劃解讀(4)MySqlAI
- Oracle sql執行計劃OracleSQL
- SQL Server執行計劃SQLServer
- SQL的執行計劃SQL
- SQL執行計劃分析SQL
- SQL優化案例-從執行計劃定位SQL問題(三)SQL優化
- 分析執行計劃優化SQLORACLE的執行計劃(轉)優化SQLOracle
- 效能調優:看看這個匪夷所思的執行計劃。
- 獲取SQL執行計劃SQL
- SQL 執行計劃案例1SQL