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.
Author |
Topic |
krisrajz
Starting Member
19 Posts |
Posted - 2010-11-15 : 05:01:20
|
One of my peer wrote a query based on multiple tables using joins.One of the table is in a different databaseThe query was taking much time and here the suggestions I have made:1. Create an SP2. Create a temp table and copy all records from the external db3. Avoid using Left Join as much as possible and use Inner Join4. Create and use indexes5. Remove tables/columns that are not necessaryIn this scenario, I would like to suggest to use Covering Index, but how can it be created for multiple tables and a temp table?Any help would be appreciatedThank youRegardsRaj |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-11-15 : 05:13:04
|
If the different database is on the same server then there shouldn't be a problem and I see no need to copy the data into a temp table.And as far as I know a covering index is delimited to one table. No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
krisrajz
Starting Member
19 Posts |
Posted - 2010-11-15 : 06:53:56
|
Both the DBs are in different servers! |
|
|
|
|
|