Wanted - Advice - Performance - Add column, update data

Discussion created by Mike_Sweetman on Mar 27, 2012
Latest reply on Mar 29, 2012 by kimo
I have a feature class with 200,000 features. Versioning and Archiving are in place too.

I have a requirement to add a new attribute to the feature class, and to update the existing features based on data provided in a csv file.

My database is oralce 11gR2 and I'm using version 10.1 of ArcGis / ArcSDE

I decided that I would create a table in oracle and load my update data into it, which woud be a list of key values and the new value for the new attribute. My code looked like the following

rows = arcpy.UpdateCursor("MYLAYER") #this is my feature class
for row in rows:    
      read_rows = arcpy.SearchCursor("MYLAYER_UPDATE","KEYVAL = '" + row.keyval + "'") #this is the update values for the feature class
      for read_row in read_rows:
   row.setValue("NEWATTRIB", read_row.newattrib)
  del rows, row, read_rows, read_row

It took so long, after 3 days I killed the script running.

I understand that if I took archiving off it could improve the performance, and if i took versioning off, I could also improve the performance, BUT, this update needs to be part of an upgrade against a production system, so I cannot take anything away, and I need to get it to run in a timely manner.

I know about the tables that make up my feature class (base table, add table, delete table, archive table) and so 'could' issue SQL directly against all tables involved to effectively backfill the new attribute.

Am I playing with fire ? Is there a way that my python script snippet could be improved / done differently ?