Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Slow query across databases on same server

Author  Topic 

thenearfuture
Starting Member

35 Posts

Posted - 2013-02-28 : 09:50:26
Hi,

We recently created a new database and moved some of our tables there. Whenever we write a query using tables from both databases, the queries take much longer than if the tables were in the same DB. The databases are both on the same server. Does anyone have any idea what might be happening?

Example: The first one takes a lot longer than the second one, and there is an index on column a in all tables.


SELECT top 10 *
FROM DB1.dbo.Table1
INNER JOIN DB2.dbo.Table2
ON Table1.a = Table2.a



SELECT top 10 *
FROM DB1.dbo.Table1
INNER JOIN DB1.dbo.Table2
ON Table1.a = Table2.a



Any suggestions are much appreciated.

Thank you.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-28 : 10:18:53
have a look at execution plan and identify the time consuming steps

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -