blocking remove

  • hi

    i am adding new column with default value

    this table has millions of rows, so while i am executing my query ,its causing blocking to other user.

    how to solve this

    example

    alter table emp

    add column senti_v int default 0

    thanks

  • Firstly, change the "add column" part to just "add".

    Secondly, this kind of process will definitely take exclusive locks on the table which will block other processes.

    I suggest that you run this process during a very quiet time or during a downtime period.

    Regards

  • You could add the column without a default value, that usually works quite quick.

    Afterwards you could update the column in chunks of for example 1 Mio rows.

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

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