Capturing IQ query plans

From SybaseWiki
Revision as of 22:52, 6 January 2008 by Psap (Talk | contribs)

Jump to: navigation, search

Capturing IQ query plans can be done when you set a few options. With the options given below a query plan is generated into the IQ message file for each query run from your session (since the option is temporary). Output from the index advisor is also added.

set     temporary option query_plan = on
set     temporary option query_plan_after_run = on
set     temporary option query_timing = on
set     temporary option query_detail = on
set     temporary option row_counts = on
set     temporary option index_advisor = on

With these options the query plan is also generated in HTML format. For practical reasons store these plans into a separate directory. The directory should be accessible by the IQ server.

set     temporary option query_plan_as_html = on
set     temporary option query_plan_as_html_directory = '<directory>'

To set the option query_plan_as_html_directory you need DBA permission, so when you set the option it makes sense to also include the username:

set     temporary option <username>.query_plan_as_html_directory = '<directory>'

An HTML query plan looks like this:

Html query plan.gif

There is also a lot of other detailed information included in the html file, but not shown in the image above.

Please note that what happens during the phase "Condition Execution" is described here: http://infocenter.sybase.com/help/topic/com.sybase.dc38151_1270/html/iqref/CACBCCAH.htm