Alter table performance

  • We have this statement:

    ALTER TABLE TD_WR ADD tf_FromWeb BIT NOT NULL DEFAULT(0);

    running against a table with over 500,000 rows. My supervisor asked me to take a look at it to make it faster because it's taking a minute and a half. I politely explained that it's a one time thing, blah blah blah,

    Anyway, looking around it appears to me that there really isn't anything I can do because it has to go through each row and set the new field to zero. Am I correct or is there a faster way to do this?

    Thank you!

    em

  • in general I'd agree with you - from what basis does your "supervisor" make the conclusion the performance isn't fast enough?

    I'd suggest that to find a way to optimise this more would take longer than 1.5 mins therefore this is the quickest.

    [font="Comic Sans MS"]The GrumpyOldDBA[/font]
    www.grumpyolddba.co.uk
    http://sqlblogcasts.com/blogs/grumpyolddba/

  • Nice one Colin 🙂

    Make your supervisor invests in faster servers and a better storage subsystem, that would help too 🙂

  • I highly recommend an upgrade to the supervisor! 

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • . . . correction - OF the supervisor!  LOL

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

  • or:

    exec sp_update_resume

    followed by

    exec sp_distribute_resume


    * Noel

Viewing 6 posts - 1 through 5 (of 5 total)

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