Most of the GUI tools create EXPLAIN tables automatically for you but if you need to create them, you can use one of the following approach.
- DB2 provides EXPLAIN.DDL in ~/sqllib/MISC directory and you can execute this file
$ db2 connect to sample $ db2 -tf ~/sqllib/MISC/EXPLAIN.DDL $ db2 terminate
- DB2 also provides a system Stored Procedure that you can execute to create EXPLAIN tables. This is most useful to execute SQL from your application if you need explain tables.
$ db2 connect to sample $ db2 "CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN','C',NULL,CURRENT SCHEMA)" $ db2 terminate