I’m attempting to add a
NOT NULL constraint to a table I have (so I can use it as part of a primary key, so I can create a spatial index…) but it is taking a really long time – 1 hour 31 minutes and counting.
I had read this post where the answer seemed to be that it was taking so long because the person was adding a default value but i’m not doing that:
ALTER TABLE unacastVisitRaw ALTER COLUMN timestamp varchar(64) NOT NULL
The table is rather large (290 million records) but it still seems like a long time for just adding a constraint and not changing any values.
Is there anything I can do to speed up this operation? Why would it be taking so long if I’m not updating the existing records?