Longest Recent Queries Trace

In the gateway there’s a location to see the longest recent queries which retains a few queries for about an hr or so if they’re more than around 250ms from what I can tell. Is there a way though to run a trace to capture all the queries through a DB connection over a set period of time such as 5 seconds?

We have one DB connection that has a very large query/sec count but only a small portion of them get placed in the longest recent queries. It would be helpful to see what the other 95% of the queries are and look for if they can be removed/updated to a different scan class.

Thanks,
Ed

I haven’t traced through all the code, but it looks like if you change the Slow Query Log Threshold in your datasource you should at least get those queries logged. You can then filter the log using MDC keys – key is “database” and value is your datasource name. The log entry will start with “Slow query”, then have the text of your query, and how many milliseconds it took to execute (from Ignition’s viewpoint).

Be sure to reset that value when you’re done to avoid flooding your logs.

So this is different than where the longest recent query threshold gets set? the DB connection setup has a slow query threshold set to the default of 60,000ms so this would not affect the display on the gateway’s DB connection’s throughput display on the status tab only the logs section is that correct?

Correct. Just the logs. The long running query tracker has a hardcoded limit of 10 per datasource.