Track Slow Queries To Clients

Perhaps there is already a way to do this and I just don’t know about it yet, but it would be nice if you could track slow database queries to the client that is running them. I see a lot of slow query messages pop in on the console now and again and it would be nice to know which client that is coming from so I can go see what they are doing or ask them what they need so I can see if I can optimize the query a little bit.

As it stands now I only know what the query is but not who is running it. It’s not a big deal but it would be helpful.

Can you tell what a user is trying to do by looking at a slow database query and where it is used in a project?