I have a stored procedure that truncates some tables with around 1.75M rows in each, before inserting new data (based on data in other tables, calculations etc.)
Basic outline is very simple:
- Truncate Tables
- Insert 1.75M rows in 'batches' of around 75,000 per time.
I am wondering if I should explicitly re-build the indexes at any time in this process? e.g.
- Truncate Tables
ALTER INDEX ALL ON xxx REBUILD WITH (FILLFACTOR=90)
[or something similar]- Insert 1.75M rows
or perhaps
ALTER INDEX ALL ON xxx DISABLE
- Truncate Tables
- Insert 1.75M rows
ALTER INDEX ALL ON xxx REBUILD WITH (FILLFACTOR=90)
[or something similar]
Any assistance appreciated...not a DBA - a Dev who knows DB's pretty well is more accurate!
insert into
and at the moment there is noorder by
clause, but I could add that if it would help? ID and Code are also indexed separately.