SlowQueryListener always shows time as 0, QueryLoggingListener shows correct time.
See original GitHub issueIt appears that while using the SlowQueryListener as shown below, the Time property in the logging is always 0. But the time appears to work correctly when using the QueryListener (without threshold specified, logs everything). I’ve run it a few times to ensure the query are not too quick and are genuinely being shown as 0. I feel like i’m missing something basic…
I’m testing against both H2 and MySQL via Hikari, JPA+Hibernate is actually executing the queries, full range of SELECTs, INSERTs, UPDATEs etc if that makes any difference. Using the latest versions of everything on Java 8 b121.
return ProxyDataSourceBuilder
.create(dataSource)
.logQueryBySlf4j(SLF4JLogLevel.INFO)
.build();
2017-03-17 11:14:29:174 INFO QueryLoggingListener - 02cbe638-eb5e-498c-b5c1-9daf154b0601 - Name:, Time:1, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:14:29:191 INFO QueryLoggingListener - 02cbe638-eb5e-498c-b5c1-9daf154b0601 - Name:, Time:2, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:14:29:207 INFO QueryLoggingListener - 02cbe638-eb5e-498c-b5c1-9daf154b0601 - Name:, Time:2, Success:True, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
return ProxyDataSourceBuilder
.create(dataSource)
.logSlowQueryBySlf4j(0, TimeUnit.MILLISECONDS)
.build();
2017-03-17 11:17:14:620 WARN F4JSlowQueryListener - - Name:, Time:0, Success:False, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:17:14:639 WARN F4JSlowQueryListener - - Name:, Time:0, Success:False, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:["..."], Params:[(...)]
2017-03-17 11:17:14:654 WARN F4JSlowQueryListener - - Name:, Time:0, Success:False, Type:Prepared, Batch:False, QuerySize:1, BatchSize:0, Query:[""], Params:[(...)]
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
SlowQueryListener always shows time as 0 ... - GitHub
It appears that while using the SlowQueryListener as shown below, the Time property in the logging is always 0. But the time appears...
Read more >Very slow queries when connecting through the listener in ...
Very slow queries when connecting through the listener in Oracle ... The "ela" value is the elapsed time of the wait, in micro-seconds...
Read more >Troubleshoot slow-running queries - SQL Server
Check if the time exceeds a threshold you have set (in milliseconds ) based on an established performance baseline.
Read more >datasource-proxy User Guide
Slow Query Logging Listener. When query takes more than specified threshold, SlowQueryListener executes a callback method. The callback is invoked only once for ......
Read more >Finding slow and low performance queries - Prisma
The output shows execution time, query size, lock time, rows examined and sent, and more. The pt-query-digest command has a lot of different...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@binakot wrote a wiki page for that. https://github.com/ttddyy/datasource-proxy/wiki/Logging-slow-queries
@ttddyy Awesome! Thanks!