<?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: very bad performance when setting extents using arcpy.env.extent in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620043#M96245</link>
    <description>&lt;P&gt;The results indicate the issue isn't with using arcpy.env.extent with a polygon.&amp;nbsp; The fact a polygon filter took twenty minutes while a simple "REGION='REGION1'" query took two or more hours tells me:&amp;nbsp; 1) the dataset is quite large (which you already indicated), and 2) the REGION field probably isn't indexed or indexed correctly if the operation is taking that long.&lt;/P&gt;&lt;P&gt;At this point I would run the same attribute test outside of ArcGIS.&amp;nbsp; If you see comparable relative differences when connecting to the database from a client outside of ArcGIS, it points to more a data structure and database performance issue than an ArcGIS software issue.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Jun 2025 14:04:50 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2025-06-02T14:04:50Z</dc:date>
    <item>
      <title>very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1619810#M96226</link>
      <description>&lt;P&gt;I have very large datasets that I process using arcpy. These datasets are broken into geographical regions, so with each run of my ETL scripts, I set arcpy.env.extent to a polygon that defines the region I'm processing. If I don't set env, a function like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.GetCount("sdefile.sde\myFeature_class")&lt;/LI-CODE&gt;&lt;P&gt;will take maybe 8-10 seconds, but if I have arcpy.env.extent set to a &lt;STRIKE&gt;relatively simple polygon&lt;/STRIKE&gt; bounding box, the same function takes 20 MINUTES! The computer I'm running the code on is a different machine than the SDE database, which is a very large Oracle Enterprise cluster. The feature class I have the most trouble with has about 5 million records per region. The features all have spatial indexes on them.&lt;/P&gt;</description>
      <pubDate>Sat, 31 May 2025 15:04:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1619810#M96226</guid>
      <dc:creator>NikMartin</dc:creator>
      <dc:date>2025-05-31T15:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1619867#M96230</link>
      <description>&lt;P&gt;Calling Get Count on an entire dataset is fast because it is basically a metadata lookup and not actually counting records.&amp;nbsp; Twenty minutes does seem a bit long for Get Count, even on 5 million records, but enterprise geodatabase connections are very sensitive to latency as well as the usual factors that impact database performance.&amp;nbsp; &amp;nbsp;How long does a Select Layer By Attribute take when you run a query like "WHERE region = 'name'" ?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 May 2025 15:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1619867#M96230</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-05-31T15:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1619910#M96241</link>
      <description>&lt;P&gt;Ran:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from timeit import default_timer as timer
import arcpy

start = timer()
print(arcpy.management.GetCount(r"Q:/ARCGIS-DEV.REGION1.sde/REGION1_BUILDINGS").getOutput(0))
end = timer()
print("Time taken: {:.2f} seconds".format(end - start))

start = timer()
arcpy.management.SelectLayerByAttribute(r"Q:/ARCGIS-DEV.REGION1.sde/REGION1_BUILDINGS", "NEW_SELECTION", "REGION='REGION1'")
end = timer()
print("Time taken for SelectLayerByAttribute: {:.2f} seconds".format(end - start))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the first call ran in 13.55 seconds, the second was still running 2 hours when I killed the process&lt;/P&gt;</description>
      <pubDate>Sun, 01 Jun 2025 19:24:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1619910#M96241</guid>
      <dc:creator>NikMartin</dc:creator>
      <dc:date>2025-06-01T19:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620043#M96245</link>
      <description>&lt;P&gt;The results indicate the issue isn't with using arcpy.env.extent with a polygon.&amp;nbsp; The fact a polygon filter took twenty minutes while a simple "REGION='REGION1'" query took two or more hours tells me:&amp;nbsp; 1) the dataset is quite large (which you already indicated), and 2) the REGION field probably isn't indexed or indexed correctly if the operation is taking that long.&lt;/P&gt;&lt;P&gt;At this point I would run the same attribute test outside of ArcGIS.&amp;nbsp; If you see comparable relative differences when connecting to the database from a client outside of ArcGIS, it points to more a data structure and database performance issue than an ArcGIS software issue.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 14:04:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620043#M96245</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-06-02T14:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620056#M96246</link>
      <description>&lt;P&gt;Using Dbeaver,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;select count (*) from REGION_BUILDINGS where REGION='REGION1';&lt;/LI-CODE&gt;&lt;P&gt;took 53 seconds, so definitely not a database issue, and that column isn't even indexed;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 14:22:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620056#M96246</guid>
      <dc:creator>NikMartin</dc:creator>
      <dc:date>2025-06-02T14:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620127#M96253</link>
      <description>&lt;P&gt;Major caveat for me - I do not write any Python code at all but I did find a related support case regarding poor performance with versioned data and the user running a select very similar to yours of REGION_BUILDINGS where REGION='REGION1'.&amp;nbsp; The long and the short of it (and resolution for the customer) was:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Resolution: It is not efficient to use layers and layer selections in the client's context.&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;STRONG&gt;GP Intersect and arcpy search cursor recommended.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Now how to rewrite the Python from GetCount to Intersect and Search Cursor, I do not know but something to explore/experiment.&amp;nbsp; Hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 16:23:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620127#M96253</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2025-06-02T16:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620132#M96255</link>
      <description>&lt;P&gt;Is the data versioned?&amp;nbsp; If so, the query that ran for 53 seconds is not comparable to the query from ArcGIS software because ArcGIS software will be using the versioned data and not base tables.&lt;/P&gt;&lt;P&gt;If the data is versioned, what does the state tree look like?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 16:37:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620132#M96255</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-06-02T16:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: very bad performance when setting extents using arcpy.env.extent</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620202#M96262</link>
      <description>&lt;P&gt;And adding to Joshua's question about whether the data is traditionally versioned or not, have the eGDB GP performance tools been performed recently?&amp;nbsp; Compress?&amp;nbsp; Analyze?&amp;nbsp; Analyze Datasets?&amp;nbsp; Rebuild Indexes?&amp;nbsp; If not, then it would not surprise me that there is poor performance.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jun 2025 19:25:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/very-bad-performance-when-setting-extents-using/m-p/1620202#M96262</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2025-06-02T19:25:06Z</dc:date>
    </item>
  </channel>
</rss>

