Currently, the queries get logged as having executed at the time when they were harvested from the slow log, not when they executed. In most, probably all cases, slow log contains a SET TIMESTAMP statement with the timestamp of when the query was executed.
That means our time resolution for queries is the length of time it takes QAN to process a batch of queries. We could improve this to 1 second by making use of the timestamp information.
To maintain behaviour similar to what happens currently, the query should be logged with start_ts of (SET TIMESTAMP + Query_time) listed in the slow log, rounded to nearest second (to evade the need to change start_ts column type. Since the timestamp in the slow log only has resolution of 1 second, switching to timestamp(6) would only improve real resolution by approximately half a second (because we would only get the fraction part of the Query_time), and that small improvement doesn't seem to justify the cost of converting potentially tens or hundreds of gigabytes of QAN tables.
Column name start_ts is misleading since this logs when the query was loaded, which is after it finished rather than when it started. But we can ignore this for now.
Currently, the queries get logged as having executed at the time when they were harvested from the slow log, not when they executed. In most, probably all cases, slow log contains a SET TIMESTAMP statement with the timestamp of when the query was executed.
That means our time resolution for queries is the length of time it takes QAN to process a batch of queries. We could improve this to 1 second by making use of the timestamp information.
To maintain behaviour similar to what happens currently, the query should be logged with start_ts of (SET TIMESTAMP + Query_time) listed in the slow log, rounded to nearest second (to evade the need to change
start_ts
column type. Since the timestamp in the slow log only has resolution of 1 second, switching to timestamp(6) would only improve real resolution by approximately half a second (because we would only get the fraction part of the Query_time), and that small improvement doesn't seem to justify the cost of converting potentially tens or hundreds of gigabytes of QAN tables.Column name
start_ts
is misleading since this logs when the query was loaded, which is after it finished rather than when it started. But we can ignore this for now.