0

Some programm generate and send queries to sql server(on high load production). I want take plan of concrete query of concrete table. I start profiler with "Showplan XML" and set filter on TextData(like %MyTable%) and DatabaseName. It show rows with xml in TextData that describe execution plans(for all queries of my table). But I know that exist 5 different sql queries for this table.

How I can match some concrete query with correspond plan without use statistic?

  • 1
    I don't really understand your question, but [here is a post on how](https://stackoverflow.com/a/7359705/6167855) and of course you can query any plan currently in the plan cache. – S3S Jan 02 '19 at 14:21
  • Yes I can use STATISTICS PROFILE(from this article), but I am afraid of bad perfomance. Is it problem? – AndreyMagnificent Jan 02 '19 at 14:31
  • You are running a trace via SQL Profiler... that's a performance concern in itself. – S3S Jan 02 '19 at 14:51

1 Answers1

0

Is there a reason this has to be done on the production environment? Most really bad execution plans (missing indexes causing table scans etc.) will be obvious enough on a dev environment where you can use all the diagnostics you want.

Otherwise running the SQL on the query cache (as in the linked question someone else mentioned) will probably have the lowest impact as it just queries a system table rather than adding diagnostics to every query.

Sam Keen
  • 1
  • 1