Creating explain snapshots for static SQL statements

Follow these steps to create an explain snapshot for a static SQL statement:

  1. If DB2 has not already been started, issue the db2start command.

  2. Ensure that explain tables exist in your database. To do this, follow the instructions in Creating explain tables.

  3. From the DB2 CLP prompt, connect to the database that you want to use. For example, to connect to the SAMPLE database, issue the connect to sample command.

  4. Create an explain snapshot for a static SQL statement by using the EXPLSNAP option when binding or preparing your application. For example, issue the BIND your file EXPLSNAP YES command.

  5. Optional. To view the access plan graph for the snapshot, refresh the Explained Statements History window (available from the Control Center), and double-click on the snapshot.

For information about using the EXPLSNAP option for equivalent APIs, see the sections for each of these in the Embedded SQL Programming Guide.