Tool for SQL Server code tuning

  • Hello experts,

    Is there a free or a paid tool/software that can be used to provide t-sql recommendations or that can provide corrections to the t-sql statement to optimize the code for e.g see below...suggesting some changes to use "in" instead of "exists". I knew of a tool that was used to do this in the past and it was "Lecco SQL Expert". However, this isn't available anymore. Is there an alternative SQL tool that can be a paid tool or free which can do this.

    SELECT
    some_data
    FROM details_table D
    WHERE EXISTS (SELECT
    1
    FROM lookup_table L
    WHERE L.lookup_column = D.lookup_column
    AND L.matching_column = 'Yes')

    can be written as
    SELECT /*+ FIRST_ROWS */
    some_data
    FROM details_table D
    WHERE lookup_column IN (SELECT
    L.lookup_column
    FROM lookup_table L
    WHERE L.matching_column = 'Yes')

  • Quest bought them out years ago. I'm not sure if it's related to the SQL Optimizer product that Quest has.
    SQL Optimizer does do the alternative sql statements you mention and benchmarks the alternatives. You might want to see if they have a trial version to test.

    Sue

  • Sue_H - Wednesday, November 22, 2017 11:18 AM

    Quest bought them out years ago. I'm not sure if it's related to the SQL Optimizer product that Quest has.
    SQL Optimizer does do the alternative sql statements you mention and benchmarks the alternatives. You might want to see if they have a trial version to test.

    Sue

    I am not sure if I can buy a license for that. I went through their portal and I couldn't find that. I think I might have to call their sales team for this. Any other alternatives?

  • ffarouqi - Wednesday, November 22, 2017 11:37 AM

    Sue_H - Wednesday, November 22, 2017 11:18 AM

    Quest bought them out years ago. I'm not sure if it's related to the SQL Optimizer product that Quest has.
    SQL Optimizer does do the alternative sql statements you mention and benchmarks the alternatives. You might want to see if they have a trial version to test.

    Sue

    I am not sure if I can buy a license for that. I went through their portal and I couldn't find that. I think I might have to call their sales team for this. Any other alternatives?

    I just did a search on: SQL Optimizer Quest
    and the download link was right there.
    SQL Optimizer for SQL Server - Download Software

    And then when I pulled out the word Quest and just had SQL Optimizer, it provided links to other tools. You may want to try searching on that and trying some of those other options.

    Sue

  • Sue_H - Wednesday, November 22, 2017 11:48 AM

    ffarouqi - Wednesday, November 22, 2017 11:37 AM

    Sue_H - Wednesday, November 22, 2017 11:18 AM

    Quest bought them out years ago. I'm not sure if it's related to the SQL Optimizer product that Quest has.
    SQL Optimizer does do the alternative sql statements you mention and benchmarks the alternatives. You might want to see if they have a trial version to test.

    Sue

    I am not sure if I can buy a license for that. I went through their portal and I couldn't find that. I think I might have to call their sales team for this. Any other alternatives?

    I just did a search on: SQL Optimizer Quest
    and the download link was right there.
    SQL Optimizer for SQL Server - Download Software

    And then when I pulled out the word Quest and just had SQL Optimizer, it provided links to other tools. You may want to try searching on that and trying some of those other options.

    Sue

    I tried creating a trial account but it says that I haven't purchased this product and need to contact customer service and there is no trial download available for this. I will have to speak to someone over there in order to get a trial link.

  • ffarouqi - Wednesday, November 22, 2017 10:01 AM

    Hello experts,

    Is there a free or a paid tool/software that can be used to provide t-sql recommendations or that can provide corrections to the t-sql statement to optimize the code for e.g see below...suggesting some changes to use "in" instead of "exists". I knew of a tool that was used to do this in the past and it was "Lecco SQL Expert". However, this isn't available anymore. Is there an alternative SQL tool that can be a paid tool or free which can do this.

    SELECT
    some_data
    FROM details_table D
    WHERE EXISTS (SELECT
    1
    FROM lookup_table L
    WHERE L.lookup_column = D.lookup_column
    AND L.matching_column = 'Yes')

    can be written as
    SELECT /*+ FIRST_ROWS */
    some_data
    FROM details_table D
    WHERE lookup_column IN (SELECT
    L.lookup_column
    FROM lookup_table L
    WHERE L.matching_column = 'Yes')

    As a bit of a sidebar, if the lookup column on the lookup table is unique and has an index on it, both of the methods might suck compare to a good ol' fashioned INNER JOIN.  If you need to be able to answer "No" when not found, then both will be better than an outer join and, depending on the data and table structure, could be a tie with each other for performance.

    I guess my question here is... you seem to have some practical knowledge... why not just do the test yourself instead of using software that you'd have to test the recommendations of anyway?

    --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 2:42 PM

    ffarouqi - Wednesday, November 22, 2017 10:01 AM

    Hello experts,

    Is there a free or a paid tool/software that can be used to provide t-sql recommendations or that can provide corrections to the t-sql statement to optimize the code for e.g see below...suggesting some changes to use "in" instead of "exists". I knew of a tool that was used to do this in the past and it was "Lecco SQL Expert". However, this isn't available anymore. Is there an alternative SQL tool that can be a paid tool or free which can do this.

    SELECT
    some_data
    FROM details_table D
    WHERE EXISTS (SELECT
    1
    FROM lookup_table L
    WHERE L.lookup_column = D.lookup_column
    AND L.matching_column = 'Yes')

    can be written as
    SELECT /*+ FIRST_ROWS */
    some_data
    FROM details_table D
    WHERE lookup_column IN (SELECT
    L.lookup_column
    FROM lookup_table L
    WHERE L.matching_column = 'Yes')

    As a bit of a sidebar, if the lookup column on the lookup table is unique and has an index on it, both of the methods might suck compare to a good ol' fashioned INNER JOIN.  If you need to be able to answer "No" when not found, then both will be better than an outer join and, depending on the data and table structure, could be a tie with each other for performance.

    I guess my question here is... you seem to have some practical knowledge... why not just do the test yourself instead of using software that you'd have to test the recommendations of anyway?

    Unfortunately, my experience on T-SQL side is very minimal and somehow code logic is not something that I am really good at...hence the need. In case if I ask someone in the forum to help me out with a problem that I am struggling with they would come back and say that we aren't paid to help you fix the code which is understandable but what other means do I have if there is no help and I can't do it myself....not every DBA is exceptional in T-SQL.

  • I never used it, you can try and let us know. 

    https://www.eversql.com/

  • goher2000 - Tuesday, January 23, 2018 10:04 AM

    I never used it, you can try and let us know. 

    https://www.eversql.com/

    Sure. I will try and let it know.

Viewing 9 posts - 1 through 8 (of 8 total)

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