quinta-feira, 3 de janeiro de 2008

Force Order Hint

This one is cool.

SELECT O.[OrderId], O.[CustomerId] FROM [Customers] C JOIN [Orders] O JOIN [Employees] E ON O.[EmployeeId] = E.[EmployeeId] ON C.[CustomerId] = O.[CustomerId] WHERE C.[City] = N'London' AND E.[City] = N'London' OPTION (FORCE ORDER, HASH JOIN)


The force order hint, instructs sql server the order that the join should be resolved. On join resolution process, sql server analyzes the number of rows on each table and decides which one will be the inner table, and the outer table. With force order sql server will use the order in the query. It could be good in some cases, when the optimizer cannot detect the best plan, but could be bad, because you can mislead the optimizer best choice.  Besides the HASH JOIN hint forces the use o a given method, you can use LOOP, HASH or MERGE.

Again, the choice for a method to solve the join depends on cardinality factors that sql server analyzes using the statistics and available indexes.


Have Fun!

ps. If you want more details about that, read Inside SQL Server 2005:  Query Tuning and Optimization by Kalen Delaney

14 comentários:

  1. You made some good points there. I did a search on the topic and found most people will agree with your blog.

  2. labored marriages incline lead-in to Sequestration creating an supposed to
    be unripened and ill-equipped to deal responsibilities.
    We were Together for near Octonary age ahead we got married, and regular though statistics you're Astonishingly Experienced in both beloved and sex.

    Also visit my web-site; Harlem Shake Miami Heat

  3. Hello! I know this is kind of off topic but I was wondering which blog platform are you using for this website?
    I'm getting tired of Wordpress because I've had problems with hackers and I'm looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.

    Check out my web-site diets that work

  4. hp laserjet 1020 drivers supports Windows XP. The HP 1020 LaserJet is a good.

    My web page http://hdnewsusa.com

  5. Fabulous, what a webpage it is! This weblog gives valuable data to us, keep it up.

    my website; loricaridae

  6. I every time used to read article in news papers but now as I am a user of net so from
    now I am using net for content, thanks to web.

    Look into my weblog - xerox 8560 cartridges

  7. Truly wonderful, should attempt it today.

    Here is my web site ... xerox phaser 8560 error codes

  8. At thiѕ time it appearѕ lіke Dгupal is the best blоgging
    platfoгm aνaіlаble rіght noω.
    (frоm what Ι've read) Is that what you'гe using оn yоuг blog?

    my wеblοg :: http://www.Aliancarussa.com/index.php?option=com_blog&view=comments&pid=1032253&Itemid=0

  9. Normally I do not read article on blogs, but I would like to
    say that this write-up very compelled me to take a look at
    and do so! Your writing style has been amazed me.
    Thank you, very nice post.

    my web site :: best web hosts

  10. There's definately a lot to find out about this subject. I like all the points you've made.

    My homepage ... xerox 8560 windows 7 driver

  11. Right here is the perfect website for anyone who wants
    to find out about this topic. You know so much its almost tough
    to argue with you (not that I really will need to…HaHa).
    You certainly put a new spin on a subject that's been discussed for ages. Excellent stuff, just wonderful!

    Also visit my web page :: xerox 8560 solid ink

  12. Right here is the perfect site for anyone who really wants to find out
    about this topic. You understand so much its almost tough to
    argue with you (not that I personally will need to…HaHa).

    You certainly put a brand new spin on a topic that's been discussed for many years. Wonderful stuff, just great!

    Feel free to surf to my blog: xerox 8560 service manual

  13. Hi there, I log on to your new stuff like every week.

    Your writing style is witty, keep up the good work!

    my weblog: Buy LG 42LS5600

  14. This functioned wonderful, delighted I found your post!
    My ML-1210 is still chugging together with Windows
    8 now. Merely one improvement though 9.61 appears to be the size (MB), not the variation.
    The variation is in fact 3.01.

    Feel free to surf to my homepage :: xerox phaser 8560 ram error (www.boroconnect.com)