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, '*') lyrAnnexations = arcpy.mapping.ListLayers(mxd, "Annexations", df) lyrCustomers = arcpy.mapping.ListLayers(mxd, "Customers", df) lyrPoles = arcpy.mapping.ListLayers(mxd, "Pole", df)
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?