onstat -g qplan command: Print running query and its plan

Use the onstat -g qplan command to display the currently running query and its plan.

Figure 1. Syntax:

1  onstat   -g qplan?  sessionid
You can specify one of the following invocations:
Table 1. Descriptions of each onstat -g qplan command invocation
Invocation Explanation
onstat -g qplan Displays the running query and its plan for each session.
onstat -g qplan sessionid Displays the running query and its plan for the session that you specify.

Example output

Figure 2. onstat -g qplan command output
select * from systables a, systables b; 

onstat –g qplan command output:
    
Session [36]: No running query to generate the plan.

Session [33]: No running query to generate the plan.

Session [32]: No running query to generate the plan.

Session [31]: No running query to generate the plan.

Session [30]: No running query to generate the plan.

Session [28]
QUERY:
------
select * from systables a , systables b

Estimated Cost: 8779
Estimated # of Rows Returned: 73984

  1) informix.b: SEQUENTIAL SCAN

  2) informix.a: SEQUENTIAL SCAN
NESTED LOOP JOIN

Session [3]: No running query to generate the plan.

Session [2]: No running query to generate the plan.