• Evgeny Garaev - Wednesday, January 17, 2018 8:23 PM

    Jeff Moden - Wednesday, January 17, 2018 5:20 PM

    It'll be interesting to see someone's face when they run this code even on a giant database right after a service bounce. 😉  A little embedded documentation would go a long way.

    I have run it on 2Tb database. 😛 But you are right it make sense to execute it on a UAT/Test database (if it is an exact copy of a production database) instead of a production database.

    I was talking about the fact that it appears that the first temporary table will have little to nothing available because the usage stats (sys.dm_db_index_usage_stats) are cleared on restart of the service.  I also wonder why a lot of people don't comment their code.

    --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)