Cut Save/Open Design Time in Half - DesignID Index

Version 3

    Recent results show that adding indices to the DesignID field of all feature and object classes that participate in a design can improve save/open design performance by as much as 60%. On a versioned geodatabase, you will also need to update the Adds tables. 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")
                except RuntimeError:
                    print("Skipping table " + table)

     

     

    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 necessary tables.