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


Issue with Current Merge Join algorithm and ways to Improve it


Issue with Current Merge Join algorithm and ways to Improve it

Author
Message
Gullimeel
Gullimeel
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1241 Visits: 506
Comments posted to this topic are about the item Issue with Current Merge Join algorithm and ways to Improve it

GulliMeel

Finding top n Worst Performing queries
Improve the performance of Merge Join(special case)
How to Post Performance Problem -Gail Shaw
SanDroid
SanDroid
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3360 Visits: 1046
What happens when you index?
Is there a Connect Article that list this issue?
Gullimeel
Gullimeel
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1241 Visits: 506
What happens when you index?


Sorry but I did not get what do you mean by create index on what or which column.

GulliMeel

Finding top n Worst Performing queries
Improve the performance of Merge Join(special case)
How to Post Performance Problem -Gail Shaw
SanDroid
SanDroid
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3360 Visits: 1046
It would depend on the recomendations of performance tuner or missing indexes dmv.
Poor query performance caused by extra seeks are historicly resolved by better indexing, primary key selections, and Foreign key relationships.
Bettter Primary keys, CLUSTERED and NON CLUSTERED indexes are solutions.
I did not notice any detail about this.
Your post does list it in the second sript as a
Work Around
. :-D
Also, I do not see the script that shows how to recreated you issue in the area of you post where you mention it. Just a
/* */
so it is difficult to understand exactly what we are resolving.
Gullimeel
Gullimeel
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1241 Visits: 506
It is not related to index. This is the case when your best index is used to get the data specially from Inner table for merge join. The issue is where to start the scan of the index. By default it is at the start of the index and I am showing in my script that for some of queries you can tell you the optimizer where to start that scan by adding extra logic. I can see the full script.Not sure why are you not able to.

Try below link

http://gullimeelsqlsybase.wordpress.com/2012/06/26/improved-merge-join-algorithm-in-sql-server-2008/

GulliMeel

Finding top n Worst Performing queries
Improve the performance of Merge Join(special case)
How to Post Performance Problem -Gail Shaw
SanDroid
SanDroid
Hall of Fame
Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)Hall of Fame (3.4K reputation)

Group: General Forum Members
Points: 3360 Visits: 1046
Gullimeel (7/11/2012)
It is not related to index. This is the case when your best index is used to get the data specially from Inner table for merge join.


I Now that I have link to your entire recreation code maybe I can test your scenario and see what you are talking about.

Although at first glance it looks like something I, as a DBA, would run a few times and then check Missing Indexes DMV. Something that I would do for any query Joining data that showed a performance issue when seeking the scan key.

I see where what you are pointing out happens. Just not how this is something unique to how MERGE JOIN is calculated by optimizer. :-D
Iwas Bornready
Iwas Bornready
One Orange Chip
One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)One Orange Chip (29K reputation)

Group: General Forum Members
Points: 29450 Visits: 885
Thanks for the script.
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