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

  1. Change the value of arcpy.env.workspace to your SDE connection or personal geodatabase.
  2. Start ArcCatalog.
  3. In ArcCatalog, select Geoprocessing > Results to open the Results pane. This pane will show the actions the script makes.
  4. Select Geoprocessing > Python to open the Python window.
  5. Copy and paste the preceding code into the Python window.
  6. Hit Enter. The script will add the indices to the necassary tables.
QR code for this page

Was this helpful?