Beware of Search Argument (SARG) Data Types

  • Great article.  Very informative.

  • Great Stuff

    Thanks

  • This was a great article. I was researching why DevExpress XPO was doing this on the back end as well. Keep in mind, this is derived from the system.data.sqlclient class and most of the ORMs inherit that class to build on top for SQL server.

    We realized a 8X difference, on average, from changing the datatype. I will say we have high performance SANs and multi-proc servers to handle the storage and CPU load, but this kept me from having to go clustered and deal with updating multiple servers and increased performance like night and day.

    This article was a God send. I really appreciate the effort!

    Wallew

  • I agree with many of the others. This is a "hidden" performance problem that a lot of people don't even consider because they don't know about things like data-type precedence. It's one of the primary reasons why some folks think Tally Table functions are slow and why some cursors appear to be faster than certain setbased queries.

    Very well done, DC... this should be required reading not only for those learning SQL, but for those teaching it, as well.

    --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 think this is one of those things in the back of my head I always knew, and just never really appreciated just how intrusive the problem could be.

    Awesome article, great presentation, and thank you. You may have just fixed something for me on Monday. 😀


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thanks, and your're welcome. I'm glad to know that the article was useful.

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/

Viewing 6 posts - 31 through 35 (of 35 total)

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