• TheSQLGuru - Tuesday, February 6, 2018 1:15 PM

    ScottPletcher - Tuesday, February 6, 2018 10:03 AM

    Fascinating.  You recommend a very inefficient method then say what a great tuner you are!  Wow, rather ::crazy::.

    I am pretty tired today, so maybe I am missing something. But how is it that storing 8 bytes less (the two ids) as I suggested is very inefficient?

    Storing the names is inefficient.  Just create your own id that cannot change and use it.  For a few rows, won't matter much.  For lots of rows, could be a huge gain.  I don't see a need to distinguish object type, so I don't, I just have a single names table that provides the id for any name.

    Although even if I chose to store the name, I would also store the original id, since certain internal / trace / relationship tables use only id not the name.  Compress the row and it'll be no more than 5 bytes the vast majority of the time.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.