• sqldba_newbie (3/1/2013)


    Jeff Moden (3/1/2013)


    opc.three (3/1/2013)


    Jeff Moden (3/1/2013)


    Actually, the change of an index CAN very much change the result especially where UPDATEs are concerned.

    I think we covered the OP's question about SELECT statements so I don't feel bad taking a sidebar here.

    Is this something to do with the quirky update? Can you provide some documentation that explains the behavior you're alluding too?

    It certainly applies to the quirky update but I wasn't referring to such an arcane method. Gail is spot on for what I meant.

    They can also affect SELECTs that use TOP with no ORDER BY. The addition of a index can instantly change what the TOP returns if the index comes into play. In most cases, of course, it is NOT something that should be relied on.

    Does have a order by something like this:

    (SELECT DISTINCT Row_number()

    OVER (

    ORDER BY AdDate ASC ) Row

    Then at the end of the query result set has:

    ORDER BY ROW ASC

    However if i remove the "inappropriate" index, query makes use of another index and provides results as expected? I did do a update stats with full scan.

    Post the exact query. Somewhere in there there's an assumption about order without an order by, hence when you change the index, the order the rows are processed changes and your query results change because of the incorrect assumption.

    Update stats has nothing to do with anything here.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass