Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Java thread is responsible for a PostgreSQL database process?

Given a JVM connecting to a PostgreSQL database (on Linux), is there a way to find out which thread in Java is responsible for a process in the database?

NB: I'm debugging a resource-leak bug, which shows up as some idle-in-transaction processes in the database. It would be useful to match these up with the thread responsible, as the thread name will narrow down the search.

like image 908
Daniel Winterstein Avatar asked Dec 21 '25 11:12

Daniel Winterstein


1 Answers

You could set application_name (with the SET statement) to something that you can match up with the Java thread name.

like image 101
kgrittn Avatar answered Dec 23 '25 23:12

kgrittn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!