SQl Server same query with different execution plan

by Blane Davis   Last Updated December 06, 2018 15:06 PM

I have a query that I run on a database on the server and it takes about 30 seconds. If I only change the database (use master;) the query runs in 2 seconds. Changing back (use Reporting_Dev;) it is back to 30+ seconds.

From each DB, there are very different query plans, but I am puzzled why this happens. It is the same query. All I did was switch the database I am running from.

The compatibility of the databases is the same so I am at a loss.

Any ideas?

Related Questions

Plan cache mystery

Updated July 23, 2018 20:06 PM

High I/O for part of query

Updated March 28, 2015 10:02 AM

Parameterized Query creating Many Plans

Updated August 30, 2018 17:06 PM