DesignID Index
To maximize performance, you will want to add indices to the DesignID field of all feature and object classes that participate in a design. You will also need to update your Adds tables if working with a versioned geodatabase. You can run the following Python script to programmatically create the necessary indices:
import arcpy
arcpy.env.workspace = r"c:\location_of_your_database\database_name.gdb"
"""
For a versioned database, point to the .sde file in your C:\Users\[username]\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog directory. Be sure to have that connection use saved credentials. See http://gis.stackexchange.com/questions/16859/define-workspace-for-sde-connection-in-python for an example.
"""
for dataset in arcpy.ListDatasets():
for fc in arcpy.ListFeatureClasses(feature_dataset=dataset):
try:
arcpy.AddIndex_management(dataset + "/" + fc, "DesignID", "DesignID")
except RuntimeError:
print("Skipping feature class " + fc + " in dataset " + dataset)
for table in arcpy.ListTables():
try:
arcpy.AddIndex_management(table, "DesignID", "DesignID")
print("Skipping table " + table) except RuntimeError:
Running the Script in ArcCatalog
- Change the value of arcpy.env.workspace to your SDE connection or personal geodatabase.
- Start ArcCatalog.
- In ArcCatalog, select Geoprocessing > Results to open the Results pane. This pane will show the actions the script makes.
- Select Geoprocessing > Python to open the Python window.
- Copy and paste the preceding code into the Python window.
- Hit Enter. The script will add the indices to the necassary tables.