oracle 执行计划查看常用sql


SELECT /*+ GATHER_PLAN_STATISTICS */ ....................


SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(FORMAT=>'ALLSTATS LAST ALL +OUTLINE'));

Plan hash value: 3657219412
  
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                              | Name            | Starts | E-Rows |E-Bytes| Cost (%CPU)| E-Time   | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                       |                 |      1 |        |       |     4 (100)|          |     10 |00:00:00.01 |    1390 |       |       |          |
|*  1 |  VIEW                                  |                 |      1 |     73 | 39274 |     4  (25)| 00:00:01 |     10 |00:00:00.01 |    1390 |       |       |          |
|*  2 |   WINDOW SORT PUSHED RANK              |                 |      1 |     73 | 76650 |     4  (25)| 00:00:01 |     30 |00:00:00.01 |    1390 |  4096 |  4096 | 4096  (0)|
|   3 |    NESTED LOOPS SEMI                   |                 |      1 |     73 | 76650 |     3   (0)| 00:00:01 |     73 |00:00:00.01 |    1390 |       |       |          |
|   4 |     TABLE ACCESS FULL                  | POST            |      1 |    500 |   256K|     3   (0)| 00:00:01 |    500 |00:00:00.01 |       7 |       |       |          |
|*  5 |     TABLE ACCESS BY INDEX ROWID BATCHED| POST_COMMENT    |    500 |     11 |  5775 |     0   (0)|          |     73 |00:00:00.01 |    1383 |       |       |          |
|*  6 |      INDEX RANGE SCAN                  | POST_REVIEW_IDX |    500 |     73 |       |     0   (0)|          |  33872 |00:00:00.01 |       8 |       |       |          |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
  
   1 - SEL$5DA710D3 / from$_subquery$_003@SEL$3
   2 - SEL$5DA710D3
   4 - SEL$5DA710D3 / P@SEL$1
   5 - SEL$5DA710D3 / PC@SEL$2
   6 - SEL$5DA710D3 / PC@SEL$2
  
Outline Data
-------------
  
  /*+
      BEGIN_OUTLINE_DATA
      IGNORE_OPTIM_EMBEDDED_HINTS
      OPTIMIZER_FEATURES_ENABLE('18.1.0')
      DB_VERSION('18.1.0')
      ALL_ROWS
      OUTLINE_LEAF(@"SEL$5DA710D3")
      UNNEST(@"SEL$2")
      OUTLINE_LEAF(@"SEL$3")
      OUTLINE(@"SEL$1")
      OUTLINE(@"SEL$2")
      NO_ACCESS(@"SEL$3" "from$_subquery$_003"@"SEL$3")
      FULL(@"SEL$5DA710D3" "P"@"SEL$1")
      INDEX_RS_ASC(@"SEL$5DA710D3" "PC"@"SEL$2" ("POST_COMMENT"."REVIEW"))
      BATCH_TABLE_ACCESS_BY_ROWID(@"SEL$5DA710D3" "PC"@"SEL$2")
      LEADING(@"SEL$5DA710D3" "P"@"SEL$1" "PC"@"SEL$2")
      USE_NL(@"SEL$5DA710D3" "PC"@"SEL$2")
      END_OUTLINE_DATA
  */
  
Predicate Information (identified by operation id):
---------------------------------------------------
  
   1 - filter(("from$_subquery$_003"."rowlimit_$$_rownumber"<=CASE  WHEN (20>=0) THEN 20 ELSE 0 END +10 AND "from$_subquery$_003"."rowlimit_$$_rownumber">20))
   2 - filter(ROW_NUMBER() OVER ( ORDER BY "P"."TITLE")<=CASE  WHEN (20>=0) THEN 20 ELSE 0 END +10)
   5 - filter("PC"."POST_ID"="P"."ID")
   6 - access("PC"."REVIEW"='Bingo')
  
Column Projection Information (identified by operation id):
-----------------------------------------------------------
  
   1 - (rowset=60) "from$_subquery$_003"."ID"[NUMBER,22], "from$_subquery$_003"."rowlimit_$$_rownumber"[NUMBER,22]
   2 - (#keys=1; rowset=60) "P"."TITLE"[VARCHAR2,1020], "P"."ID"[NUMBER,22], ROW_NUMBER() OVER ( ORDER BY "P"."TITLE")[22]
   3 - "P"."ID"[NUMBER,22], "P"."TITLE"[VARCHAR2,1020]
   4 - "P"."ID"[NUMBER,22], "P"."TITLE"[VARCHAR2,1020]
   6 - "PC".ROWID[ROWID,10]

ALTER SESSION SET STATISTICS_LEVEL='ALL';

1

ALTER SESSION SET STATISTICS_LEVEL='TYPICAL'

你可能感兴趣的:(数据库,mysql)