ESRI.ArcGIS.DataManagementTools.DeleteFeatures  Slow in .NET

2288
2
01-27-2011 08:16 AM
MeleKoneya
Occasional Contributor III
I am using ESRI.ArcGIS.DataManagementTools.DeleteFeatures to delete from a File Geodatabase using the Geprocessor object in .NET and it is very slow (minutes).

The same code run against an ArcSDE Geodatabase is fast (seconds).   
The GDB is ArcGIS 10 as is the code I am building my .NET app with.   

Any thoughts on why this could would run slower against a File Geodatase?

Thanks,

Mele

Below is the code I am using to call DeleteFeatures.

ESRI.ArcGIS.Geoprocessor.GeoprocessorGP = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();

public static void DeleteFCFeatures(IFeatureClass FC)
        {
            try
            {
               
                DeleteFeatures deleteFeatures = new DeleteFeatures();
                deleteFeatures.in_features = FC;
                ITrackCancel Itrack = null;
                RunTool(GP, deleteFeatures, Itrack);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n\n" + ex.StackTrace);
            }
        }
private static void RunTool(Geoprocessor geoprocessor, IGPProcess process, ITrackCancel TC)
        {
           

            try
            {
                geoprocessor.Execute(process, null);
                processGPMessages(geoprocessor);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                processGPMessages(geoprocessor);
            }
        }
0 Kudos
2 Replies
AlexanderGray
Occasional Contributor III
hi there,
If you are allow to turn off your virus scan for a test, I would do that first.
ArcSDE vs file geodatabase is a tough comparison.  It depends on so many variables.   Is the ArcSDE feature class versioned or not? The speed of the network.  Is the File Geodatabase on your local drive.  How fast is the fgdb drive.  How fast is the ArcSDE server.  How much data in feature class is being deleted.  What database server is being used.  How well the ArcSDE has been tune.  Just having a virus scan on your computer can slow you down a lot because fgdb is made of many files that have to be written to.  If the virus scan is scanning the files or the hard drive is busy at that time, the process will be slowed down.  ArcSDE (even local with SQL express) does not suffer from this problem.  Deleting a bunch of records in a file geodatabase means making a bunch of file write operations, deleting in ArcSDE means issuing SQL statements to the underlying database.  Databases are designed to handle large volumes of data so I would expect the ArcSDE to be faster if you have many records (in the thousands or more).
0 Kudos
MeleKoneya
Occasional Contributor III
I changed my code to pass in a string to the Feature Class (.sde file) and it works much faster.

Geoprocessor does not seem to operate as well on IFeatureClass as it does on a string.

Mele
0 Kudos