
create explain table:
- Call the SYSPROC.SYSINSTALLOBJECTS procedure:
1
2db2 CONNECT TO database-name
db2 "CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN', 'C', CAST (NULL AS VARCHAR(128)), CAST (NULL AS VARCHAR(128)))"
This call creates the explain tables under the SYSTOOLS schema. To create them under a different schema, specify a schema name as the last parameter in the call.
- Run the EXPLAIN.DDL DB2® command file:
1
2db2 CONNECT TO database-name
db2 -tf EXPLAIN.DDL
This command file creates explain tables under the current schema.It is located at the DB2PATHmisc directory on Windows operating systems, and the INSTHOME/sqllib/misc directory on Linux and UNIX operating systems. DB2PATH is the location where you install your DB2 copy and INSTHOME is the instance home directory.
use below script to generate execution plan
1 |
|
use db2expln
1 |
db2expln -database <dbname> -u <user> <password> -t -g -f <inputsqlfile> |




近期评论