Gather information about embedded SQL statements with the PRTSQLINF command

 

The Print SQL Information (PRTSQLINF) command returns information about the embedded SQL statements in a program, SQL package (the object normally used to store the access plan for a remote query), or service program. This information is then stored in a spooled file.

PRTSQLINF provides information about:

This output is similar to the information that you can get from debug messages. However, while query debug messages work at runtime, PRTSQLINF works retroactively. You can also see this information in the second level text of the query governor inquiry message CPA4259.

You can issue PRTSQLINF in a couple of ways. First, you can run the PRTSQLINF command against a saved access plan. This means execute or at least prepare the query (using SQL's PREPARE statement) before you use the command. It is best to execute the query because the index created as a result of PREPARE is relatively sparse and may well change after the first run. PRTSQLINF's requirement of a saved access plan means the command cannot be used with OPNQRYF.

You can also run PRTSQLINF against functions, stored procedures, triggers, SQL packages, and programs from iSeries™ Navigator. This function is called Explain SQL. To view PRTSQLINF information, right-click an object and select Explain SQL.

 

Parent topic:

Optimizing query performance using query optimization tools

 

Related information


Print SQL Information (PRTSQLINF) command