Try updating the statistics for the tables and see if that makes any
difference
-----Original Message-----
From: Coskan Gundogar [mailto:[Email Address Removed]
Sent: Tuesday, December 16, 2003 3:12 AM
To: LazyDBA.com Discussion
Subject: problem about joinin tables of two db
hi i have two db on the same server
i must query them together.
i make joins between tables of two different databases.
when i run the query on DB_1 the execution plan gives warnings about
missing statistics for the tables on DB_2 when i run the query on DB_2
everything is normal query is quick
anyone has an idea about what couses this situation?
sample query without warning about DB_2
use DB_2
select t1.c1, t2.c1,t3.c2,t4.c3
from
server.DB_1.dbo.table1 t1
join table2 t2 on t2.c3=t1.c1
join server.DB_1.dbo.table3 t3 on t3.c2=t2.c4 and t1.c5=t3.c4 join
table4 t4 on t4.c4=t2.c3
sample query with warnings about DB_2
use DB_1
select t1.c1, t2.c1,t3.c2,t4.c3
from
table1 t1
join server.DB_2.dbo.table2 t2 on t2.c3=t1.c1
join table3 t3 on t3.c2=t2.c4 and t1.c5=t3.c4
join server.DB_1.dbo.table4 t4 on t4.c4=t2.c3
MS Sql Server LazyDBA home page