How to Stop Parameter Sniffing in SQL Server

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 ส.ค. 2017
  • Are your query parameters being sniffed by SQL Server? Learn how to recognize and solve parameter sniffing performance problems in your SQL queries. Links below.
    Blog post: blog.bertwagner.com/why-param...
    Follow me on Twitter:
    / bertwagner
    Want to receive the latest weekly blog posts and videos in your inbox? Sign up for the newsletter here: upscri.be/c77fc8/
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 19

  • @hovardlee
    @hovardlee 3 ปีที่แล้ว +2

    Watch Brent Ozar on yt about it.
    It is quite normal that your data can change. This is why you are tuning your queries over time. This is nothing wrong cause your data is growing constantly and this is why you have your job :)

  • @grandetaco4416
    @grandetaco4416 2 หลายเดือนก่อน

    I like the 3rd option, but hate it too and not just for maintenance. The idea of having to put that through peer review and production approval would be lovely to explain to others as well as documenting everything so people know why you have duplicate code.

  • @gopiadabala3562
    @gopiadabala3562 5 ปีที่แล้ว +2

    Fantastic explanation Bert, this really helped me.
    I have resolved many issues in my environment(ETL) with this energy.
    Thank you for investing your time in such a great knowledge sharing session.

  • @CharlieArehart1
    @CharlieArehart1 5 ปีที่แล้ว +1

    Great explanation, Bert. It's a problem that has plagued many for years (even decades). There are still other solutions one could consider, and more have been added to later and later versions of SQL Server. (And actually, the problem can plague more than just SQL Server.)
    But this is a really well-done demonstration of the problem and some basic solutions which may be all many need. Thanks for the effort!

  • @AlejandroBelloRD
    @AlejandroBelloRD 3 ปีที่แล้ว +1

    Most excellent nit-picky explanation on how to force the optimizer to work for you. Especially useful for, for example, SSRS.

  • @shaikzuhair8537
    @shaikzuhair8537 4 ปีที่แล้ว +1

    Clear and good explanations.in very short period of time

  • @ssrakeshsharma
    @ssrakeshsharma 6 ปีที่แล้ว +1

    Hey Nicely Explained, Thanks from Afghanistan

  • @randeepsinghmatharu9071
    @randeepsinghmatharu9071 6 ปีที่แล้ว +3

    First 2 options are great and often used. The 3rd option as you explained, can be a nightmare especially if for example, new countries are added to your table that aren't specifically optimised for in the procedure.
    Another option surprisingly not mentioned, is declaring local variables in your SP that pick up the variables past through say an application like SSRS. This avoids parameter sniffing altogether... A blessing but occasionally a curse too! Good video!!

    • @gopiadabala3562
      @gopiadabala3562 5 ปีที่แล้ว

      Good analysis, but Bert already told about the maintenance which required for option 3 :-)

  • @notcranium
    @notcranium 6 ปีที่แล้ว

    Good video. Thanks for making it! That espresso shot extraction at the end was terrible though! 10.5 seconds is way too fast! You need to grind it finer to get it up to ~28 seconds (assuming the volume of coffee is good as well as the tamping pressure being adequate). :)

  • @natanaelmontes1836
    @natanaelmontes1836 2 ปีที่แล้ว

    Saludos desde México muy buena explicación y sobre todo explicas la solución contundente.

  • @FlashDark
    @FlashDark 6 ปีที่แล้ว +2

    It's really hot in there (thanks for the explanation) ^^

  • @tao5198
    @tao5198 4 ปีที่แล้ว

    Thx for good explanation!

  • @aurelianpaulmuresan5326
    @aurelianpaulmuresan5326 4 ปีที่แล้ว +1

    Good video. Do you know how can I improve the performance into a stored procedure that has multiple table type parameters? I added the option recompile but that didn't help too much.

    • @erwinekkel9676
      @erwinekkel9676 4 ปีที่แล้ว

      Easy do not use table parameters. Instead use temp tables

  • @christianrodier3381
    @christianrodier3381 3 ปีที่แล้ว

    All options have their trade offs

  • @ngwustephen3035
    @ngwustephen3035 4 ปีที่แล้ว

    I get this error, "mysql.connector.errors.ProgrammingError: Not enough parameters for the SQL statement" in mysql, please how do I resolve it?

  • @sergolobovi767
    @sergolobovi767 6 ปีที่แล้ว

    what happened with your right ear???

  • @ettyobz
    @ettyobz 6 ปีที่แล้ว

    Clap clap