Prayer

在一般中寻求卓越
posts - 1256, comments - 190, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

举个例子,对于数据库SAMPLE中程序包DB2INST1.P0203450,使用下面命令:
db2expln -d SAMPLE -g -c db2inst1 -p P0203450 -s 0 -t
其中
-g 是指给出存取计划的图形输出(用字符模拟的)
-s 0 是指分析所有的SQL命令

下面是相应的输出:
DB2 Universal Database Version 7.2, 5622-044 (c) Copyright IBM Corp. 1991, 2001
Licensed Material - Program Property of IBM
IBM DATABASE 2 SQL Explain Tool

Processing package DB2INST1.P0203450.
******************** PACKAGE *********************

Package Name = DB2INST1.P0203450
--------Prep Date = 2002/12/17
--------Prep Time = 16:02:04

--------Bind Timestamp = 2002-12-17-16.02.04.373971

--------Isolation Level ---------= Cursor Stability
--------Blocking---------------- = Block Unambiguous Cursors
--------Query Optimization Class = 5

--------Partition Parallel ------= No
--------Intra-Partition Parallel = No

--------Function Path----------- = "SYSIBM", "SYSFUN", "DB2INST1"

Processing Section 1.
-------------------- SECTION ----------------------
......
-------------------- SECTION ----------------------
Section = 2

SQL Statement:

update STAFF set NAME = 'test'
where ID = 350

Estimated Cost = 75
Estimated Cardinality = 2

Access Table Name = DB2INST1.STAFF ID = 2,3
| #Columns = 2
| Relation Scan
| | Prefetch: Eligible
| Lock Intents
| | Table: Intent Exclusive
| | Row : Update
| Sargable Predicate(s)
| | #Predicates = 1
Update: Table Name = DB2INST1.STAFF ID = 2,3

End of section

Optimizer Plan:

------UPDATE
------( -2)
------/-- \
-TBSCAN --Table:
--( 3) --DB2INST1
---| -----STAFF
Table:
DB2INST1
STAFF
......


可以用下面命令找出数据库中存在的程序包:
db2 "select pkgschema, pkgname from syscat.packages"
上面例子中的程序包DB2INST1.P0203450是一个存储过程。

 


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理