Better TSQL Performance

  • PrettyMegaDBA - Wednesday, November 22, 2017 9:23 AM

    Grant Fritchey - Wednesday, November 22, 2017 9:19 AM

    Yow!

    I feel your pain. I'll try to get a moment to look at the plan, but, I'd say in addition to the code changes I suggested, you need to focus on clustered indexes first. The plan is probably a bit of a waste of time at the moment with no indexes on the tables. It's going to be all scans.

    Thanks so much!

    I agree with Grant. A proper clustered index will help you a lot and will change the plan immensely. To give you an idea on how indexes could affect a query, here's one example (totally unrelated) showing how a process went from over a day to approximately one minute. http://www.sqlservercentral.com/articles/set-based+loop/127670/

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • drew.allen - Wednesday, November 22, 2017 8:25 AM

    Jeff Moden - Wednesday, November 22, 2017 8:20 AM

    PrettyMegaDBA - Wednesday, November 22, 2017 8:16 AM

    Thank you all for your responses.  All have been very helpful.  And forgive me, I lost my formatting somewhere between copy & paste, I will ensure its formatted better in the future.  I will take the comments into consideration and see if that helps. 

    PMD

    The formatting thing has been a problem ever since they "improved" the forum software.  :angry:

    You can't blame this one on the forum software.  The code was not included in the proper SQL Code tags.

    Drew

    If you look at the code that was included in the tags, it still sucks. 😉  I'm also thinking that it wasn't copied and pasted directly from SSMS either.

    --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)

  • Jeff Moden - Wednesday, November 22, 2017 3:50 PM

    drew.allen - Wednesday, November 22, 2017 8:25 AM

    Jeff Moden - Wednesday, November 22, 2017 8:20 AM

    The formatting thing has been a problem ever since they "improved" the forum software.  :angry:

    You can't blame this one on the forum software.  The code was not included in the proper SQL Code tags.

    Drew

    If you look at the code that was included in the tags, it still sucks. 😉  I'm also thinking that it wasn't copied and pasted directly from SSMS either.

    I try NOT to copy/paste directly from SSMS, it adds extra lines that I can't seem to remove.  I go to a text editor, UltraEdit, first.  Even then I have had issues with the SQL Code block at times.

  • Lynn Pettis - Wednesday, November 22, 2017 3:55 PM

    Jeff Moden - Wednesday, November 22, 2017 3:50 PM

    drew.allen - Wednesday, November 22, 2017 8:25 AM

    Jeff Moden - Wednesday, November 22, 2017 8:20 AM

    The formatting thing has been a problem ever since they "improved" the forum software.  :angry:

    You can't blame this one on the forum software.  The code was not included in the proper SQL Code tags.

    Drew

    If you look at the code that was included in the tags, it still sucks. 😉  I'm also thinking that it wasn't copied and pasted directly from SSMS either.

    I try NOT to copy/paste directly from SSMS, it adds extra lines that I can't seem to remove.  I go to a text editor, UltraEdit, first.  Even then I have had issues with the SQL Code block at times.

    It didn't use to be that way just before this latest change.  They spent a good amount of time making sure that the code windows worked great and they did.  All that is gone now and it doesn't matter whether you use IE, FireFox, Chrome, or whatever Web Browser you prefer.

    --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 4 posts - 16 through 18 (of 18 total)

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