Question

I found a query in the plan cache that needs parameterizing. Not sure which app created this query. Is there a good way in SQL to track down the app that put a given query in cache?

sql2014

Was it helpful?

Solution

No, information about what sent the query to the server (user, application, IP, etc.) isn't stored in the plan cache or Query Store, or associated views.

You can catch that information while a query is running using sp_WhoIsActive, or logging it to a table.

If you have a good monitoring tool, it may have gathered that information. If you have a bad one, it probably didn't.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top