I have a script to update a field in one feature class from a selected record in another feature class. This is done through looping through records in one feature class selecting appropriate the record in the other then reading the ID and updating the first feature class. I ran some tests on small subsets of the data and it worked fine. When i run across the full data set the MXD crashes (there are 30,000+/- records in the first feature class and 80,000 in the second). I am assuming this has something to do with memory, but I am not sure. Any help in solving this issue or improving the efficiency of the script (included below) is much appreciated. thanks.
import arcpy
cur = arcpy.UpdateCursor("layer_1")
for i in cur:
st=i.getValue("Street")
if st[-4:] == 'PKWY' or st[-4:] == 'EXPY':
pass
else:
qry = "Street = '"+st+"'"
arcpy.SelectLayerByAttribute_management("TAMED_BUF","NEW_SELECTION",qry)
arcpy.SelectLayerByLocation_management("TAMED_BUF","CONTAINS","layer_1",1,"SUBSET_SELECTION")
cur2=arcpy.SearchCursor("TAMED_BUF")
for row in cur2:
seg=row.getValue("SegmentID")
i.T_SegmentID = seg
cur.updateRow(i)
del cur,cur2,i,row