Welcome to WebmasterWorld Guest from 184.108.40.206 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Subscribe to WebmasterWorld
performance issue for JOIN between different databases in MSSQL? LifeinAsia msg:3921115 7:02 pm on May 27, 2009 (gmt 0) In MS SQL, we have 2 databases on the same server (same instance of SQL Server): DB1 (with table TableA), DB2 (with table TableB).
We currently do a JOIN across the databases, e.g.:
SELECT a.Field1, b.Field2 FROM TableA a INNER JOIN DB2.[dbo].TableB b ON a.ID=b.ID
Would there be any significant performance gain by moving TableB to DB1? And then we would just do:
SELECT a.Field1, b.Field2 FROM TableA a INNER JOIN TableB b ON a.ID=b.ID
da_pinky msg:3921248 10:59 pm on May 27, 2009 (gmt 0)
i havent used ms sql since 2005, but it shouldnt make a big difference. depends on a lot of other things as well, like how many records do you have in each table, are they in cache etc. i guess a.ID and b.ID already has an index on it? LifeinAsia msg:3921259 11:23 pm on May 27, 2009 (gmt 0)
Yup- indexed. I finally copied the tables (the above example was simplified somewhat) in question over to the other database and ran some comparison tests.
No difference that I could see. Which is nice- now I don't have to go back and do a lot of recoding!