SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


left hash JOIN - Could it ever give wrong results?


left hash JOIN - Could it ever give wrong results?

Author
Message
curious_sqldba
curious_sqldba
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2904 Visits: 3636
Let me tell you, i do know using hints should be the last option. I am really in a situation where i need to address a issue by hook or crook ( actually most of my issues are addressed like this :heheSmile. I have a left join which is executing for each record, i looked in the exec plan and it is using a Nested loop. My goal was to have it execute ONLY once, so i replaced with left hash JOIN and this made it execute only once and made query much much faster. My question is would this type left hash JOIN ever NOT GIVE the same result as LEFT Join.
Alexander Suprun
Alexander Suprun
Mr or Mrs. 500
Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)Mr or Mrs. 500 (511 reputation)

Group: General Forum Members
Points: 511 Visits: 1516
sqldba_newbie (3/22/2013)

Let me tell you, i do know using hints should be the last option. I am really in a situation where i need to address a issue by hook or crook ( actually most of my issues are addressed like this :heheSmile. I have a left join which is executing for each record, i looked in the exec plan and it is using a Nested loop. My goal was to have it execute ONLY once, so i replaced with left hash JOIN and this made it execute only once and made query much much faster. My question is would this type left hash JOIN ever NOT GIVE the same result as LEFT Join.

Only if there is a bug in SQL Server, because query hints should not affect the results at all.

And also consider this:
http://msdn.microsoft.com/en-us/library/ms181714.aspx
If one or more query hints cause the query optimizer not to generate a valid plan, error 8622 is raised.



Alex Suprun
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search