AnsweredAssumed Answered

arcpy.env.workspace assignment takes excessively long (3 minutes)

Question asked by jay.gregory on Dec 2, 2014

I wrote a script to determine how long it takes to set arcpy.env.workspace to a series of feature datasets within an enterprise geodatabase(SDE 10.2.2 on SQL Server 2012), and these are my results.  You can see that some of the assignments take longer than 3 minutes, and it's just assigning a workspace!

 

7.3149998188seconds to set EONGIS.SDE.faa as workspace

1.0720000267seconds to set EONGIS.SDE.mlquery as workspace

222.508000135seconds to set EONGIS.SDE.naturalhazards as workspace

79.6970000267seconds to set EONGIS.SDE.partnerfeeds as workspace

0.561000108719seconds to set EONGIS.SDE.space as workspace

2.94499993324seconds to set EONGIS.SDE.Boundaries as workspace

221.398999929seconds to set EONGIS.SDE.naturalhazards2 as workspace

 

For reference, here is the script:

 

import arcpy, time
uri = r"C:\EsriEON\eon\publishing\connections\eon_connection.sde"
arcpy.env.workspace = uri
dsets = arcpy.ListDatasets()
for dset in dsets:
     start = time.time()
     arcpy.env.workspace = uri + "\\" + dset
     end = time.time()
     print str(end-start) + "seconds to set " + dset + " as workspace"

 

So obviously the naturalhazards feature dataset is the most problematic.  But so is partnerfeeds.  Naturalhazards2 is an exact copy of the original naturalhazards.  I created naturalhazards2 to see if there was some corruption in naturalhazards. 

 

Here's some contextual information...

My geodatabase is mostly feature datasets with feature classes inside, but also has some locators, and a toolbox.  There is nothing unique about any of the feature datasets except the data within them.  Each contains between 2 and 6 feature classes and that's it, and each is used as the source for some server map services.  Does anyone have any suggestions on why these times may vary so much?  How to troubleshoot why some may be taking longer than others?

 

Thanks!

Outcomes