|
|
兄弟在此先谢一个先。
下面是explain的结果:
DB2 Universal Database Version 9.5, 5622-044 (c) Copyright IBM Corp. 1991, 2007
Licensed Material - Program Property of IBM
IBM DATABASE 2 Explain Table Format Tool
******************** EXPLAIN INSTANCE ********************
DB2_VERSION: 09.05.0
SOURCE_NAME: SQLC2G13
SOURCE_SCHEMA: NULLID
SOURCE_VERSION:
EXPLAIN_TIME: 2009-08-04-15.11.51.359000
EXPLAIN_REQUESTER: YANGLU
Database Context:
----------------
Parallelism: None
CPU Speed: 3.227686e-007
Comm Speed: 100
Buffer Pool size: 1000
Sort Heap size: 52
Database Heap size: 600
Lock List size: 1569
Maximum Lock List: 97
Average Applications: 1
Locks Available: 129364
Package Context:
---------------
SQL Type: Dynamic
Optimization Level: 5
Blocking: Block All Cursors
Isolation Level: Cursor Stability
---------------- STATEMENT 1 SECTION 203 ----------------
QUERYNO: 1
QUERYTAG:
Statement Type: Select
Updatable: No
Deletable: No
Query Degree: 1
Original Statement:
------------------
select *
from deadtable
where c1=2 or c1 = 3
Optimized Statement:
-------------------
SELECT Q3.C1 AS "C1"
FROM YANGLU.DEADTABLE AS Q3
WHERE Q3.C1 IN (2, 3)
Access Plan:
-----------
Total Cost: 0.0160821
Query Degree: 1
Rows
RETURN
( 1)
Cost
I/O
|
2
IXSCAN
( 2)
0.0160821
0
|
5
INDEX: YANGLU
INDX1
Extended Diagnostic Information:
--------------------------------
No extended Diagnostic Information for this statement.
Plan Details:
-------------
1) RETURN: (Return Result)
Cumulative Total Cost: 0.0160821
Cumulative CPU Cost: 49825.5
Cumulative I/O Cost: 0
Cumulative Re-Total Cost: 0.00463641
Cumulative Re-CPU Cost: 14364.5
Cumulative Re-I/O Cost: 0
Cumulative First Row Cost: 0.0139097
Estimated Bufferpool Buffers: 1
Arguments:
---------
BLDLEVEL: (Build level)
DB2 v9.5.0.808 : s071001
HEAPUSE : (Maximum Statement Heap Usage)
64 Pages
STMTHEAP: (Statement heap size)
2048
Input Streams:
-------------
2) From Operator #2
Estimated number of rows: 2
Number of columns: 1
Subquery predicate ID: Not Applicable
Column Names:
------------
+Q4.C1(A)
2) IXSCAN: (Index Scan)
Cumulative Total Cost: 0.0160821
Cumulative CPU Cost: 49825.5
Cumulative I/O Cost: 0
Cumulative Re-Total Cost: 0.00463641
Cumulative Re-CPU Cost: 14364.5
Cumulative Re-I/O Cost: 0
Cumulative First Row Cost: 0.0139097
Estimated Bufferpool Buffers: 1
Arguments:
---------
MAXPAGES: (Maximum pages for prefetch)
ALL
PREFETCH: (Type of Prefetch)
NONE
ROWLOCK : (Row Lock intent)
NEXT KEY SHARE
SCANDIR : (Scan Direction)
FORWARD
TABLOCK : (Table Lock intent)
INTENT SHARE
Predicates:
----------
3) Sargable Predicate
Comparison Operator: In List (IN), evaluated by binary search (list sorted at compile-time)
Subquery Input Required: No
Filter Factor: 0.4
Predicate Text:
--------------
Q3.C1 IN (2, 3)
Input Streams:
-------------
1) From Object YANGLU.INDX1
Estimated number of rows: 5
Number of columns: 2
Subquery predicate ID: Not Applicable
Column Names:
------------
+Q3.C1(A)+Q3.$RID$
Output Streams:
--------------
2) To Operator #1
Estimated number of rows: 2
Number of columns: 1
Subquery predicate ID: Not Applicable
Column Names:
------------
+Q4.C1(A)
Objects Used in Access Plan:
---------------------------
Schema: YANGLU
Name: DEADTABLE
Type: Table (reference only)
Schema: YANGLU
Name: INDX1
Type: Index
Time of creation: 2009-07-31-15.48.02.165002
Last statistics update: 2009-08-03-15.22.56.296000
Number of columns: 1
Number of rows: 5
Width of rows: -1
Number of buffer pool pages: 2
Distinct row values: No
Tablespace name: RESOURCE
Tablespace overhead: 7.500000
Tablespace transfer rate: 0.060000
Source for statistics: Single Node
Prefetch page count: 32
Container extent page count: 32
Index clustering statistic: 100.000000
Index leaf pages: 1
Index tree levels: 1
Index full key cardinality: 5
Index first key cardinality: 5
Index first 2 keys cardinality: -1
Index first 3 keys cardinality: -1
Index first 4 keys cardinality: -1
Index sequential pages: 0
Index page density: 0
Index avg sequential pages: 0
Index avg gap between sequences:0
Index avg random pages: 1
Fetch avg sequential pages: 0
Fetch avg gap between sequences:0
Fetch avg random pages: 1
Index RID count: 6
Index deleted RID count: 1
Index empty leaf pages: 0
Base Table Schema: YANGLU
Base Table Name: DEADTABLE
Columns in index:
C1
Base Table For Index Not Already Shown:
---------------------------------------
Schema: YANGLU
Name: DEADTABLE
Time of creation: 2009-07-31-15.48.01.977001
Last statistics update: 2009-08-03-15.22.56.296000
Number of data partitions: 1
Number of columns: 1
Number of rows: 5
Number of pages: 2
Number of pages with rows: 1
Table overflow record count: 0
Indexspace name: RESOURCE
Tablespace name: RESOURCE
Tablespace overhead: 7.500000
Tablespace transfer rate: 0.060000
Prefetch page count: -1
Container extent page count: 32
Long tablespace name: RESOURCE
查阅部分资料后觉得可能是红色的那部分的问题。
难道它是不是就是所谓的Residual Predicates?
另外,or怎么就被解释成了In了? 哎,看来偶还是很小白的。
继续查东西去吧 |
|