|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Which query would be more efficient?
I've got a query that needs to join about 10 tables, and is taking too long to run. So in the interest of speeding things up, I would like to know which of the following queries would be more efficient when implemented on a much larger scale.
Code:
--Query1 SELECT Table1.Field1, Table1.Field2, Table2.Field3, Table2.Field4 FROM Table1 INNER JOIN Table2 ON Table1.JoinField = Table2.JoinField AND Table2.Field3 = 'Value' Code:
--Query2 SELECT Table1.Field1, Table1.Field2, Table2.Field3, Table2.Field4 FROM Table1 INNER JOIN Table2 ON Table1.JoinField = Table2.JoinField WHERE Table2.Field3 = 'Value' Thanks! |
|
#2
|
||||
|
||||
|
Have you run them in query analyzer and view their execution plan??? By hitting Ctrl + L you can view exactly how efficient a query is.
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
|||
|
|||
|
those two statements are exactly the same because of the inner join ... inner join always does filtering ... so ... same same ....
execution plan shows that. it'd be different if it was a left outer join .... |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Which query would be more efficient? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|