Tutorial/Tips on writing SPs that are fast and upto standards of development

  • and the thing is that when I read common mistakes...I cant appreciate them since I dont know whats the correct way of doing that thing...what to do in this situation?

  • idrees.butt (2/3/2009)


    and the thing is that when I read common mistakes...I cant appreciate them since I dont know whats the correct way of doing that thing...what to do in this situation?

    Ask someone.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • idrees.butt (2/3/2009)


    Can you give a general, simple and very good example of how to do that shift? like an alternate way(column wise thinking) to what a normal person would do (row wise thinking)

    One more thing is that I have been seeing so many links...I can just save them for now!! but cant read all...is that necessary to read all that at once? or how should I plan it?

    The reason there are so many links is because there is so much information. This is not a simple topic where we can give you four things to always do, four things to never do, and we've covered 98% of anything that you're going to run into. There are lots of things you should be doing and lots of things shouldn't. The volume of information that you're getting in this post is just a minor fraction of what's available.

    My strongest recommendation, get a good, basic, TSQL book and start there. I suggest Itzik Ben Gan's T-SQL Fundamentals.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • idrees.butt (2/3/2009)


    and the thing is that when I read common mistakes...I cant appreciate them since I dont know whats the correct way of doing that thing...what to do in this situation?

    What do you do for any situation? Start with the fundamentals and build on them. If you don't have the fundamentals, that's where you need to start.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • I know thats really bad that I am weak in fundamentals!

    OK here is the thing....I couldnt find the books in market or online (free I mean) so I will have to purcahse it online...I would want to buy 1 only for now! should I buy the one with fundamentals? or anyone else?

    I will be back then once I will be go through rather read that one book!

  • I'd start with Itzik's book. It'll get you going. As you've seen, there's tons more out there, but you have to start somewhere.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Actually I have been working in writing SPs...so I dont think I should get a book that just tells syntax etc... I need to get insight of pros and cons as how to write effecitve queries that are not only effective but also efficient...that teaches me what to choose among many options for a given problem...

    I think there should be a second level of book for me! would that still be the one you suggested? I would also wait for others to respond on this keeping in mind my situation...

    THank you so much for your time...

  • idrees.butt (2/3/2009)


    Actually I have been working in writing SPs...so I dont think I should get a book that just tells syntax etc... I need to get insight of pros and cons as how to write effecitve queries that are not only effective but also efficient...that teaches me what to choose among many options for a given problem...

    Get Izik's book. I seriously doubt that you'll find nothing useful in it.

    I think there should be a second level of book for me! would that still be the one you suggested? I would also wait for others to respond on this keeping in mind my situation...

    The Inside SQL Server 2005 series. Especially "T-SQL Querying", "T-SQL Programming" and "Query Optimisation and Tuning"

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • idrees.butt (2/3/2009)


    Actually I have been working in writing SPs...so I dont think I should get a book that just tells syntax etc... I need to get insight of pros and cons as how to write effecitve queries that are not only effective but also efficient...that teaches me what to choose among many options for a given problem...

    I think there should be a second level of book for me! would that still be the one you suggested? I would also wait for others to respond on this keeping in mind my situation...

    THank you so much for your time...

    Chapter 2, elements of the SELECT statement which shows logical processing order is worth the cost of the book alone. He has a similar explanation in Chapter 1 of the TSQL Querying book

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Jeff Moden (2/2/2009)


    Max (2/2/2009)


    Jeff Moden (2/2/2009)


    The chicken was loyal...

    ... the pig was dedicated. 😛

    Only problem was that the pig didn't last that long - minor omission though, everyone give Jeff a round of applause. :w00t:

    Heh... Where do you think the pork chops actually come from, Max? 😉

    Argh, clearly gotta catch up on the pork chop thing...

    Max

  • One thing that I wana specify is that it was my first post on this forum and I am happy to see that the views to this post are above 1000 now and there are so many replies! Thats so encouraging

  • idrees.butt (2/3/2009)


    Can you give a general, simple and very good example of how to do that shift? like an alternate way(column wise thinking) to what a normal person would do (row wise thinking)

    Yep... write a stored procedure that will count from 1 to 100,000. Post it here and well talk about it.

    One more thing is that I have been seeing so many links...I can just save them for now!! but cant read all...is that necessary to read all that at once? or how should I plan it?

    It takes time to become more than just a casual user... lots of time... and lots of practice. Time is the one thing most people won't spend on getting good.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • idrees.butt (2/4/2009)


    One thing that I wana specify is that it was my first post on this forum and I am happy to see that the views to this post are above 1000 now and there are so many replies! Thats so encouraging

    First, drop the sarcasm... it's just a distraction and it won't help you in T-SQL. 😉

    For every person that actually knows how to write high performance SQL and is willing to share some of their knowledge on this forum, there are 10,000 or 20,000 that do not or will not. You've been in business long enough to know that.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I am in the process of ordering the books online.

    I know unless I read atleast one book at a reasonable level, I cant participate well!

    I will write the SP that counts from 1 to 100000 but I dont get how that will explain row-wise thinking vs column wise thinking! I hope I am going to paste the write SP :S

  • idrees.butt (2/5/2009)


    I am in the process of ordering the books online.

    Don't bother... it comes free with SQL Server... it IS the "Help" system in SQL Server.

    I will write the SP that counts from 1 to 100000 but I dont get how that will explain row-wise thinking vs column wise thinking! I hope I am going to paste the write SP :S

    If you don't the way most people do, you'll understand when I get done.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 31 through 45 (of 54 total)

You must be logged in to reply to this topic. Login to reply