Cross-database query’s and Query Store

When you use the Query Store, you could miss load on your database if query’s are launched from another database. Query’s are stored in the database from where they are  launched.

Let me show you this with an example. We have a query that is launched from the AdventureWorks2019 database. It doesn’t touch any resources in the AdventureWorks2019 database. It only queries tables in the AdventureWorks2017 database.

You’re gut-feeling my tell you that this query will be persisted in the Query Store on the AdventureWorks2017 database but it isn’t.

Screenshot of the Query Store of the AdventureWorks2019 database

There’s no clear indication that warns your for cross database query’s. The only way (I know) is to look at the query itself or the execution plan.

 

Leave a Comment

Scroll to Top