Output from the onstat -g sql session_id and onstat -g stm session_id commands display the SQL statement most recently executed by the specified user session. In Version 8.50 and in earlier versions of Extended Parallel Server, this display concatenates successive lines of multiline SQL statements, discarding linefeed characters. But if the ISO-compliant double-hyphen ( -- ) symbols are used as comment indicators in the original SQL statement text to disable statement elements by concealing them from the SQL parser, the absence of linefeeds can make the output display ambiguous, as in the following example:
Suppose that a user in session 12 issues the following query, in which a self-join has been disabled by an ISO-compliant comment:
SELECT --+ USE_INDEX(test)
* FROM "holgerk".stv a, -- Table
systables b--,systables c
WHERE a.tabid=b.tabid; -- AND a.tabid=c.tabid;
Suppose that the DBA subsequently issues the following command:
onstat -g sql 12
Then the portion of the resulting XPS 8.50 output that displays the current SQL statement for session 12 has this format:
Current SQL statement :
SELECT --+ USE_INDEX(test) * FROM "holgerk".stv a, -- Table
systables b--,systables c WHERE a.tabid=b.tabid
Because of the comments and undisplayed linefeeds, it is not clear whether or not the WHERE clause (among several syntax elements) was commented out in the original statement text, which cannot be reconstructed from this display.
In Version 8.51, however, the corresponding output reproduces the original format of the query:
Current SQL statement:
SELECT --+ USE_INDEX(test)
* FROM "holgerk".stv a, -- Table
systables b--,systables c
WHERE a.tabid=b.tabidHere the query text is unambiguous, despite the embedded ISO-compliant comments.
In releases earlier than XPS 8.51, the onstat -g sql display of SQL statements that use braces ( { ... } ) or C-style slash and asterisk ( /* ... */ ) symbols to delimit embedded comments are not subject to this ambiguity, because those comments end with an explicit terminator symbol, rather than with a linefeed.
In Extended Parallel Server 8.51, the onstat -g stm session_id command similarly preserves original linefeeds when it displays SQL statement text.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]