I’m wondering if its possible to “pause” a clustered index whenever bulk data is being written?
The reason is that:
- Bulk inserts are slow (10,000 rows/second) if I have a clustered index on “DateTime”.
- Bulk inserts are fast (180,000 rows/second) if I have an inactive clustered index on “DateTime”.
I don’t mind if the clustered index is rebuilt overnight, e.g. from 1am to 6am.
You can’t disable a clustered index and still use the table.
Since the clustered index IS THE TABLE having it disabled means you can’t access any of the data.
From MSDN:
You can…
DROPall indexes (including clustered) and insert, thenCREATEthem overnight. This will render the table basically unusable, though.My preferred solution for this is a little more complicated:
INSERTinto a staging table that has the same clustered index key as your target tableINSERTfrom staging into target overnight and update indexes as needed then