Dropping and creating new columns

  • Hello,

    I have inherited a script which creates new columns on a table, and then drops some other columns on the same table.

    My question is, would there be any performance improvement, if I were to drop the unwanted columns first, before adding the new columns?

    Thanks

  • Maybe.

    If you add columns not null with an actual default value, rows will be rewritten, so in that case, yes , then the old columns will be gone.

    Otherwise no because the drop column is only a "logical" drop.

    Only at maintenance time (rebuild or maintenanceplan) rows will be

    rewritten according to the new columns.

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

Viewing 2 posts - 1 through 1 (of 1 total)

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