SQLTRACE part 2Today we will now cover part 2 of the new SQL tracing facility inCheetah. In part 1 we discussed how to enable SQLTRACE and how tomonitor it via onstat -g his. I'm sure you noticed that while onstat -ghis provides a lot of very useful information, you would need someserious awk and sed skills to script it, for example, that you only sawqueries that had an average execution time of 1 second or more.Fortunately SQL tracing is set up in the sysmaster database. The tableis called

This table allows you to quickly get subsections of the SQL traceoutput. So, for example, you can find out how many queriestookmore than 1 second to run by executing the following query:

select count(*) fromsyssqltrace where sql_totaltime >1;

You can obviously drill down and get additional information includingthe actual queries that were run that took more than 1 second.

The table syssqltrace is not the only table, however, that coversinformation regarding SQL tracing. The table syssqltrace_iterprovides information in the form of an iterator tree for each sql. This allows you to know what part of your plan took the mosttime to run.

These two tables allow you to use the information gathered from SQLtracing, and will allow you to generate reports, and diagnose problemSQL more efficiently.