有效使用 Optim Query Tuner 工具进行 SQL 查询语句的优化
2009-12-07 00:00:00 来源:WEB开发网查看原图(大图)
查看原图(大图)
由图 10 可知,两表都有的 LOCATION 列可以为空值,即可增加两个本地谓词来增加查询的有效性。于是在上述结果的基础上改写查询语句为如下形式,成为最终的优化结果:
SELECT HEX(SUBSTR(T1.STMT, 48, 1)) AS HEXMRIC,
CAST(SUBSTR(T1.STMT, 48, 1) AS CHAR(1) CCSID EBCDIC FOR SBCS DATA) AS DBRMMRIC,
HEX (SUBSTR(T1.STMT, 47, 1)) AS HEXPDRM,
CAST(SUBSTR(T1.STMT, 47, 1) AS CHAR (1) CCSID EBCDIC FOR SBCS DATA) AS DBRMPDRM
FROM SYSIBM.SYSPACKSTMT T1, SYSIBM.SYSPACKAGE T2
WHERE T1.LOCATION =' '
AND
T2.LOCATION =' '
AND
T1.COLLID = :H :H AND
T1.NAME = :H :H AND
T1.VERSION = :H :H AND
T1.COLLID = T2.COLLID AND
T1. LOCATION = T2. LOCATION AND
T1. CONTOKEN = T2. CONTOKEN AND
T1.NAME = T2.NAME AND
T1.VERSION = T2.VERSION AND
T2.TYPE = ' ' AND
T1.SECTNO = 0 AND
T1.SEQNO = 0 AND
T1.STMTNO = 0
图 11. 最终的执行结果图
更多精彩
赞助商链接