<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: arcpy.da.InsertCursor running slow compared to append in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187653#M14440</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Performance wise, I wouldn't be surprised if &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm"&gt;Append &lt;/A&gt;and &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/copy-rows.htm"&gt;Copy Rows &lt;/A&gt;were comparable, but there is the functional difference where &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm"&gt;Append &lt;/A&gt;requires an existing table/dataset/etc... while &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/copy-rows.htm"&gt;Copy Rows &lt;/A&gt;has to create a new one.&amp;nbsp; Since the OP's original workflow includes truncating a table instead of deleting it, there may be a requirement that prevents the use of &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/copy-rows.htm"&gt;Copy Rows&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In terms of the performance of &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/searchcursor-class.htm"&gt;ArcPy Data Access cursors &lt;/A&gt;versus &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/searchcursor.htm"&gt;ArcPy original/older cursors &lt;/A&gt;versus ArcObjects in .NET or C++, there is a post over at &lt;A href="http://gis.stackexchange.com/"&gt;GIS StackExchange &lt;/A&gt;that discusses the topic:&amp;nbsp; &lt;A href="http://gis.stackexchange.com/questions/108807/how-is-the-data-access-cursor-performance-so-enhanced-compared-to-previous-versi"&gt;How is the data access cursor performance so enhanced compared to previous versions?&lt;/A&gt;&amp;nbsp; &lt;A href="https://community.esri.com/migrated-users/3016"&gt;Jason Scheirer&lt;/A&gt;​, one of the &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.da&lt;/SPAN&gt; developers, explains how they improved the performance of the new cursors, but he also states that ArcObjects in .NET or C++ is still over twice as fast as &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.da&lt;/SPAN&gt; cursors.&amp;nbsp; Since the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm"&gt;Append &lt;/A&gt;tool is native ArcObjects, the OP's runtimes seem reasonable, or at least not surprising, when talking about bulk transferring of data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 May 2015 13:52:45 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2015-05-06T13:52:45Z</dc:date>
    <item>
      <title>arcpy.da.InsertCursor running slow compared to append</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187650#M14437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a sql server spatial table of around 9M points which for backup purposes I'm scripting to create a copy in SDE.&amp;nbsp; I was initially truncating the SDE table and using append to re-populate which took around 3 hours.&amp;nbsp; 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.&amp;nbsp; I'm fairly new to using these cursors, so I maybe don't have this configured correctly, so any advise would be appreciated.&amp;nbsp; Sample of the code is below.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sql_tb = "INPUT_SQL_TB"
&amp;nbsp;&amp;nbsp;&amp;nbsp; sde_fc = "OUTPUT_SDE_FC"
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(sde_fc,['FIELD1','FIELD2','SHAPE@XY']) as icur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.SearchCursor(sql_tb,['FIELD1','FIELD2','SHAPE@XY']) as scur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for srow in scur:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; icur.insertRow(srow)
&amp;nbsp;&amp;nbsp;&amp;nbsp; del icur,scur&lt;/PRE&gt;&lt;P&gt;Thanks in advance for any feedback, Mike.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:29:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187650#M14437</guid>
      <dc:creator>MichaelBarker</dc:creator>
      <dc:date>2021-12-11T09:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor running slow compared to append</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187651#M14438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd research a bit more and look into another way to bulk insert into SDE.&amp;nbsp; Since it's SQL Server, you'd probably get far better performance with a Stored Procedure rather than doing it application-side.&amp;nbsp; Maybe "sde.st_geometry" table insert would be a starting point to look into?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(sorry I don't have any specific examples at the moment)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 20:28:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187651#M14438</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2015-05-01T20:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor running slow compared to append</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187652#M14439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When using Esri tools, I've always understood that append was the quickest way to do a mass insert. You could also try &lt;A href="http://resources.arcgis.com/en/help/main/10.2/0017/0017000000n4000000.htm"&gt;Copy Rows&lt;/A&gt; to see if that's any different.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 May 2015 22:41:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187652#M14439</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-05-01T22:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor running slow compared to append</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187653#M14440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Performance wise, I wouldn't be surprised if &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm"&gt;Append &lt;/A&gt;and &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/copy-rows.htm"&gt;Copy Rows &lt;/A&gt;were comparable, but there is the functional difference where &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm"&gt;Append &lt;/A&gt;requires an existing table/dataset/etc... while &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/copy-rows.htm"&gt;Copy Rows &lt;/A&gt;has to create a new one.&amp;nbsp; Since the OP's original workflow includes truncating a table instead of deleting it, there may be a requirement that prevents the use of &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/copy-rows.htm"&gt;Copy Rows&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In terms of the performance of &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/searchcursor-class.htm"&gt;ArcPy Data Access cursors &lt;/A&gt;versus &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/searchcursor.htm"&gt;ArcPy original/older cursors &lt;/A&gt;versus ArcObjects in .NET or C++, there is a post over at &lt;A href="http://gis.stackexchange.com/"&gt;GIS StackExchange &lt;/A&gt;that discusses the topic:&amp;nbsp; &lt;A href="http://gis.stackexchange.com/questions/108807/how-is-the-data-access-cursor-performance-so-enhanced-compared-to-previous-versi"&gt;How is the data access cursor performance so enhanced compared to previous versions?&lt;/A&gt;&amp;nbsp; &lt;A href="https://community.esri.com/migrated-users/3016"&gt;Jason Scheirer&lt;/A&gt;​, one of the &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.da&lt;/SPAN&gt; developers, explains how they improved the performance of the new cursors, but he also states that ArcObjects in .NET or C++ is still over twice as fast as &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.da&lt;/SPAN&gt; cursors.&amp;nbsp; Since the &lt;A href="http://desktop.arcgis.com/en/desktop/latest/tools/data-management-toolbox/append.htm"&gt;Append &lt;/A&gt;tool is native ArcObjects, the OP's runtimes seem reasonable, or at least not surprising, when talking about bulk transferring of data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 13:52:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187653#M14440</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-05-06T13:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.da.InsertCursor running slow compared to append</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187654#M14441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all for the suggestions.&amp;nbsp; As mentioned by Joshua I had a need to retain the table thus the truncate and append and why copy rows wouldn't have suited, at least in this case.&amp;nbsp; After some further testing I did find that the da.insert was quicker with smaller tables (~10-100K records), but append won out on the large table (~9M records). &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 May 2015 15:21:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-da-insertcursor-running-slow-compared-to/m-p/187654#M14441</guid>
      <dc:creator>MichaelBarker</dc:creator>
      <dc:date>2015-05-06T15:21:49Z</dc:date>
    </item>
  </channel>
</rss>

