AnsweredAssumed Answered

arcpy.da.InsertCursor running slow compared to append

Question asked by mbarker on May 1, 2015
Latest reply on May 6, 2015 by mbarker

I have a sql server spatial table of around 9M points which for backup purposes I'm scripting to create a copy in SDE.  I was initially truncating the SDE table and using append to re-populate which took around 3 hours.  To improve performance I read about using the da.Insert and search cursors and having implemented that do have it working, but it took around 8 hours.  I'm fairly new to using these cursors, so I maybe don't have this configured correctly, so any advise would be appreciated.  Sample of the code is below.

    sql_tb = "INPUT_SQL_TB"
    sde_fc = "OUTPUT_SDE_FC"
    with arcpy.da.InsertCursor(sde_fc,['FIELD1','FIELD2','SHAPE@XY']) as icur:
        with arcpy.da.SearchCursor(sql_tb,['FIELD1','FIELD2','SHAPE@XY']) as scur:
            for srow in scur:
                icur.insertRow(srow)
    del icur,scur

Thanks in advance for any feedback, Mike.

Outcomes