AnsweredAssumed Answered

Performance is slower after using Reconcile/Post

Question asked by NEOMAPPER on Feb 7, 2018
Latest reply on Feb 8, 2018 by TMorgan-esristaff

We have a Reconcile/Post routine that runs once a week on our enterprise geodatabase. When the script runs and finishes the editing performance is painful. The features load very quickly outside of editing but when we begin editing the performance drop 200%. 

import arcpy, time, smtplib, os
deleteVersions = True
reconcileLog = r'C:\temp\Reconcile_Log.txt'

# set the workspace
arcpy.env.workspace = 'Database Connections/SDE.sde'

# Set a variable for the workspace
adminConn = arcpy.env.workspace

# Block new connections to the database.
print("The database is no longer accepting connections")
arcpy.AcceptConnections(adminConn, False)

# Wait 15 minutes
#time.sleep(900)

# Disconnect all users from the database.
print("Disconnecting all users")
arcpy.DisconnectUser(adminConn, "ALL")

# Get a list of versions to pass into the ReconcileVersions tool.
print("Getting list of all versions")
versionList = arcpy.ListVersions(adminConn)

for version in versionList:
    if 'default' in version.lower():
        if 'dbo' in version.lower():
            defaultVersion = 'dbo.DEFAULT'
        elif 'sde' in version.lower():
            defaultVersion = 'sde.DEFAULT'


# Execute the ReconcileVersions tool.
print("Reconciling/posting/deleting all versions")
if deleteVersions:
    try:
        arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "DELETE_VERSION", reconcileLog)
    except:
        reconcileMessage = "Reconcile failed:  " + arcpy.GetMessages() + ".  Check reconcilelog.txt file in the " + str(reconcileLog)
        arcpy.AddWarning(reconcileMessage)
        pass
else:
    try:
        arcpy.ReconcileVersions_management(adminConn, "ALL_VERSIONS", defaultVersion, versionList, "LOCK_ACQUIRED", "NO_ABORT", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", reconcileLog)
    except:
        reconcileMessage = "Reconcile failed:  " + arcpy.GetMessages() + ".  Check reconcilelog.txt file in the " + str(reconcileLog)
        arcpy.AddWarning(reconcileMessage)
        pass
print("Completed Reconcile & Post")

# Run the compress tool.
print("Running compress")

arcpy.Compress_management(adminConn)
print("Compress Completed")

# Allow the database to begin accepting connections again
print("Allow users to connect to the database again")
arcpy.AcceptConnections(adminConn, True)

print("Starting Rebuild Indexes")
# Get a list of all the datasets the user has access to.
# First, get all the stand alone tables, feature classes and rasters.
dataList = arcpy.ListTables() + arcpy.ListFeatureClasses() + arcpy.ListRasters()

# Next, for feature datasets get all of the datasets and featureclasses
# from the list and add them to the master list.
for dataset in arcpy.ListDatasets("", "Feature"):
    arcpy.env.workspace = os.path.join(adminConn,dataset)
    dataList += arcpy.ListFeatureClasses() + arcpy.ListDatasets()

# Get the user name for the workspace
userName = arcpy.Describe(adminConn).connectionProperties.user.lower()

# remove any datasets that are not owned by the connected user.
userDataList = [ds for ds in dataList if ds.lower().find(".%s." % userName) > -1]

# Execute rebuild indexes
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.RebuildIndexes_management(adminConn, "SYSTEM", userDataList, "ALL")
print('Rebuild Complete')

# Update statistics on the system tables
print("Updating statistics on the system tables")
# Execute analyze datasets
# Note: to use the "SYSTEM" option the workspace user must be an administrator.
arcpy.AnalyzeDatasets_management(adminConn, "SYSTEM", userDataList, "ANALYZE_BASE","ANALYZE_DELTA","ANALYZE_ARCHIVE")
print("Analyze Complete")

print("Finished.")

Mapping Software: Version 10.6

ArcGIS Server

Portal for ArcGIS

Two ArcGIS Web Adaptors

SQL Server 2012

Operating System

Windows Server 2012 R2

 

Outcomes