Hi I set up SQL Anywhere monitor and i get mails with long running queries. But they do not contain statement. The database is started with the -zl option. How can i set this to be on on all connections? A query has been running longer than the 10 s threshold. A query issued by connection 'SQL_DBC_1ca0cfc0' (ID 10) has been running for 47 s. In order to see the query being executed, last statement recording must be turned on. To turn on last statement recording, execute the following in DBISQL: CALL sa_server_option( 'RememberLastStatement', 'ON' ). Alternatively, last statement recording can be turned on using the -zl dbsrv12 server option. The message: To solve this problem, try closing the connection that issued this query. Check the query to make sure that it is not unnecessarily costly (for example, using a JOIN without a WHERE clause). A long running query may also be symptomatic of a database server under a heavy workload. Check that the database server is not currently performing cache- or CPU-intensive queries, and that the number of connections is within acceptable limits. |
Is that a question or just a report?
That is not necessary, it is set for all connections - cf. the command line's description:
Here's what Foxhound says about Last Statement; some of the discussion may apply to the SQL Anywhere Monitor (which is a different product)...
A question, since something must be missing since i did not see the query even when i added -zl. My guess is that this is because MAX_CLIENT_STATEMENTS_CACHED was set to 10. I set it to 0 and will see if it works.