Bulk loading data into ESRI FeatureClasses
Yesterday, I was talking to a developer who was writing import scripts to load data from his legacy databases into ArcSDE FeatureClasses. Half way into our discussion, I realized that he wasn’t taking advantage of the IFeatureClassLoad interface in ArcObjects which speeds up the importing of data into the ArcSDE by magnitudes. It achieves it performance boost by suspending updates to the spatial index after every feature is added to FeatureClass and by updating the spatial index only after the FeatureClass is taken out of the load-only mode.
To quote ESRI’s documentation
IFeatureClassLoad is an optional interface supported by feature classes in ArcSDE and feature classes and tables in File Geodatabase. It improves performance of data loading.
With ArcSDE, putting a feature class in load-only mode disables updating of the spatial index while data is loading. In a File Geodatabase, putting a feature class or table in load-only mode disables updating of spatial and attribute indexes while data is loading. Taking the feature class or table out of load-only mode rebuilds the indexes.
While a feature class or table is in load-only mode, other applications cannot work with the data. A feature class or table should be placed in load-only mode only after acquiring an exclusive schema lock on the feature class via the ISchemaLock interface.
Dig into this code sample here for more details on using IFeatureClassLoad. And if you end up locking up your FeatureClass while using IFeatureClassLoad, use the ‘sdetable‘ with the ‘-o normal_io‘ option to get yourself out of trouble.