Re: Record Users' SQL stmts & Their output
Posted in 1997
gis81566@cis.nctu.edu.tw (Xiong) wrote:
:
: I want to record users' SQL statements and their output and
:store these data in a database. I want to complete the job with triggers.
:However, I don't know:
:
: 1. Which system catalog is used to store users' current SQL statements?
Explained by Jason Harris
: 2. Is it safe to write an insert trigger in sysmaster?
Definitly not. sysmaster is read only and you can add no triggers or
stored procedures to it.
Remember that sysmaster to a large extent is only a view into memory
structures. There is no real insert/delete/update activity going on.
Do RTFM on this.
: 3. How to avoid recurisive execution of the above trigger?
See above
: 4. I can record SQL statements results with triggers, but is it possible to
: work out a method to do "Create trigger xxx before SELECT ..."?
Are there any select triggers? I don't currently use triggers, but
seem to remember they are on insert/update/delete only.
: Or is there other methods to record the output of users'
: SELECT statements?
The output? Do you mean everything selected (inconceivable), any error
codes or other things available from the sqlca record (number of rows
actually retrieved might be interesting)?.
The only way I know is to do it in the application. There it would be
easy enough. If you don't write it yourself I don't know a way.
: 5. Is it possible to complete my subject with other solution except
: triggers?
I hardly know a way at all except as suggested to use the set explain
on and look at the sqexplain file. For many purposes this is enough.
Why do you want all this data? If it's for tuning there are of course
a lot of data available via various onstat and other commands.
:Hope someone can help me solve these questions. Any suggestion/help/hint are
:appreciated!
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org