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
 General SQL Server Forums
 New to SQL Server Programming
 Multiple JOIN to same Table (Speed?)

Author  Topic 

MacJK
Starting Member

24 Posts

Posted - 2011-01-20 : 15:56:04
Hello all,

I am wondering on a query I made.

I have 8 LEFT OUTER JOIN to one other table. If I run the query It take 1 min.

If I remove one of the JOIN it takes about 500ms. It doesn’t matter which join.

The tables are not big about 2000 lines each. I Have only a PK Indexon each.

My Question:
1. How affect a JOIN on a table? (Did I get locks?)
2. Should I create for each JOIN an Index to avoid locks?
or have you some other speed tips on joins?

Many thanks!!

Jaroslaw


br
Jaroslaw

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-20 : 22:28:19
Can we see the query and the table definition?
Go to Top of Page

ahmeds08
Aged Yak Warrior

737 Posts

Posted - 2011-01-21 : 00:43:29
try using 'NOLOCK' on all the tables used in the join.
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-01-21 : 00:52:08
Before we say Yes or No to both/any of your questions, we would require more information as Russell asked!

Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-21 : 13:14:56
quote:
Originally posted by ahmeds08

try using 'NOLOCK' on all the tables used in the join.



Bad idea. Don't do that.
Go to Top of Page
   

- Advertisement -