by Dean Savović | 8:20 am

On my Query Store presentation on Windays 2017 conference I had a interesting question I decided to write a blog about. The question was where is the query stored when query uses linked server?

My setup is the following:

  1. ServerA – DatabaseA – query store on, Capture Mode All
  2. ServerB – DatabaseB – query store on, Capture Mode All
  3. Linked Server on ServerA – [ServerB]

First query is executed on ServerA and looks like this:

select * from [ServerB].DatabaseB.TableB

The query was recorded in DatabaseA query store. As expected.

Second query is executed on ServerA as pass-through query and looks like this:

select * from OPENQUERY ([ServerB], ‘select * from DatabaseB.TableB’) t

I expected the query to be recorded in DatabaseA and DatabaseB, but the query was only recorded in Database A.

Comments

No comments yet...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Shares