My python script looks at layers in an MXD, then does a couple of clip and measure operations and generates a PDF.

It works accurately and quickly (0.5-3 seconds) when all the layers in the MXD are from SDE database #1.

It works accurately and slowly (20-50 seconds) when one of the layers in the MXD is from SDE database #2 -- even though:

  • the analysis process is only happening on layers from SDE #1 -- the data from #2 is just there to look pretty
  • all the data is in the same projection

The only time that the script might be dealing with that particular layer is when the MXD and layer variables are first all defined. (Each of these layers -- Annexations, Customers, Pole -- are in SDE #1.)

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, '*')[0]
lyrAnnexations = arcpy.mapping.ListLayers(mxd, "Annexations", df)[0]    
lyrCustomers = arcpy.mapping.ListLayers(mxd, "Customers", df)[0]
lyrPoles = arcpy.mapping.ListLayers(mxd, "Pole", df)[0]

I rebuilt the MXD from scratch with the same layers, and saw the exact same issue. Add layer from SDE #2, the script is much slower. Take layer from SDE #2 out of the map, the script goes back to its original speed.

I asked the network/database guy if he knew what was going on, and he'd never seen anything like it. How can a layer that isn't involved in an analysis have any impact on performance, let alone slow it down 10x?

  • My initial guess is that there might be something wrong with the SDE database #2. What is your version? Is SDE database #2 located on the same machine as #1? I would test copying the problematic feature classes from the db #2 to db #1 and add the layers to see if the problem is with feature classes themselves. Jan 14, 2015 at 15:07
  • They're on different physical servers. (Ironically, the database guy said his connection to SDE #2 is always faster.) I can't copy the feature classes around without involving a lot of other folks in approving a schema change, etc. -- this is a massive corporate database :\
    – Erica
    Jan 14, 2015 at 15:57


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.