Skip to main content

TRACE SQL STMT

A performance trace can be obtained using the TRACE statement modifier. It collects  trace information in a table accessed by sys.tracelog(), which can be queried using ordinary SQL statements. This internal temporary table is reset each new query being traced. Its definition is given below:

CREATE FUNCTION sys.tracelog()
    RETURNS table (
        ticks bigint,       -- time in microseconds
        stmt string         -- actual MAL statement executed
    )
   EXTERNAL NAME sql.dump_trace;

CREATE VIEW sys.tracelog AS SELECT * FROM sys.tracelog();

For more detailed performance analysis consider using the Stethoscpe.