Accessing view from Arcpy (ArcGisPro) is very slow

260
2
04-15-2021 01:52 AM
leonoestergaard
New Contributor III

Hi

My DB is hosted on a MS SQL server. I have created a view (its very simple just a join of 2 tables )

When I access tje view from older version of arcpy it is fast, but when i try from newer version it very slow. 

Here is some example code

import arcpy
import sys
from datetime import datetime

version = arcpy.GetInstallInfo()
pyVersion = sys.version

print("ProductName: {}".format(version['ProductName']))
print("Version: {}".format(version['Version']))
print("Python version: {}".format(pyVersion))
start = datetime.now()

arcpy.GetCount_management(r"C:\Connections\SDE@MyDB.sde\simpelView")
end =  datetime.now()

print(end-start)

When i run the code from the old version of python af arcpy this is the result:

ProductName: Desktop
Version: 10.2.1
Python version: 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]
0:00:17.431000

I took about 17sec

Now i execute the same code, on the same computer, with the same connectionfile, but using newer version of arcpy and python

ProductName: ArcGISPro
Version: 2.5
Python version: 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)]
3:00:01.225900

I takes 3 hours.

Why is there such a huge diffrence?

 

 

2 Replies
DanPatterson
MVP Honored Contributor

That version of arcgis Pro is a couple of versions old.  And differences in access times between arcmap and Pro have been noted many times.

A better test is to work with local copies of the data leaving server issues out altogether

Read this to see if there is anything that can help your situation

Troubleshooting Performance Issues in ArcGIS Pro - Esri Community


... sort of retired...
0 Kudos
leonoestergaard
New Contributor III

While my views was simple, I didnt realize that I joined it with another view. The other view contained a where x not in (select x from y)  This caused the very poor performance. I changed the view to use "except" instead of the subquery in the where, at now i performs very nice

0 Kudos