We have an insert that is running poorly and we believe it is because of the number of indexes on the table. It is a very large table (approx 30 million rows). The insert is run in a batch process utilizing a stored proc. We would like to dynamically drop and recreate any indexes on it. I'd rather not hardcode them in the even we add some in the future and forget to address the hardcoding. I also think we could get by with only dropping the non-clustereds so the recreation doesn't take so long so it would be nice if we could identify these specifically.
Is there anyway to dynamically identify the indexes, drop them before the insert and recreate them after the insert?