• suneet.mlvy (5/9/2013)


    drew.georgopulos (5/8/2013)


    all take the same hit on Sort?

    Is there any way to mitigate that or conditions that make one cheaper than another forcing uniqueness?

    thanks very much

    drew

    I don't think there is any alternative(other than mentioned) way to get unique data.

    It depends upon the shape of the data. If there are relatively few distinct values in the set, then Paul White's super-fast distinct, which uses seeks instead of sorts, can execute many times faster than native DISTINCT.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden