Assuming you're running OnLine 7.X, there are several ways.
As one person suggested, if you can control the SQL, put a "SET EXPLAIN ON"
at the beginning of the SQL and it will give you the statements run, as well
as optimizer info, in a file called sqexplain.out. But if you had control
of the SQL, you'd already have the statements that are being run, so this
obviously isn't what you need.
Another person suggested queries against the sysmaster database; this will
work even if you don't have access to the SQL source. All you need is the
session ID number. This assumes, of course, that you've got OnLine 7.X.
A third way would be with onstat. Just do an "onstat -g sql <session-id>".
This will give you all the information you need. Again, you need OnLine 7.X
and the session ID number.
Unfortunately, the last two methods are sort of hit-and-miss, because you
only get the SQL currently being run at the time the statement is issued --
these methods won't capture every SQL statement that gets executed.
Nevertheless, these methods should be sufficient, because you should at
least be able to capture the time-consuming SQL statements.
Hope This Helps,
- Thomas J. Girsch
Database Systems Manager
Arch Communications Group, Inc.
tgirsch@arch.com
Ricardo Palmeira wrote in message <67ln96$5ja@cssun.mathcs.emory.edu>...
>Is there a way on Informix to monitor all SQL statements done by a
>specific session. I'd like to catch them all to optimize those
>statements.
>
>Ricardo Palmeira <palmeira@tce.pe.gov.br>