<?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: Optimize SQL query using ST_GEOMETRY in Geodatabase Questions</title>
    <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806289#M2901</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess on the time would be related to the number of spatial functions that have to run to calculate what is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many FLOODZONE and PARCEL polys are we talking about?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the end result, what if you remove the "&lt;SPAN style="background-color: #ffffff;"&gt;GROUP BY hashid" would it give you the output format that you are looking for?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Just as a comparison, have you created a Python script to do the same process and see how long that takes to run?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Aug 2018 19:36:21 GMT</pubDate>
    <dc:creator>George_Thompson</dc:creator>
    <dc:date>2018-08-08T19:36:21Z</dc:date>
    <item>
      <title>Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806288#M2900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looking for help to optimize a SQL query in ORACLE.&amp;nbsp; What this does is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take two polygon layers, overlay/intersect them, and where they intersect, summarize the attributes of the overlay to a aggregate list if the area of intersection is more than 15% of the source poly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;hashid,&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--this is an aggregate function that sorts and groups overlayed floodzones by parcel&lt;/STRONG&gt;&lt;BR /&gt; LISTAGG (TO_CHAR (fld_zone), '','') WITHIN GROUP (ORDER BY fld_zone) FLOODZONE&lt;BR /&gt; FROM MCGIS.FEMA_2014_FLOOD_ZONES e, parcel.parcels_mv p&lt;BR /&gt; WHERE&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--get matching polygons&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;st_intersects (p.shape, e.shape) = 1&lt;BR /&gt; AND&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--use polygon if more than 15% overlay&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(st_area (st_intersection (p.shape, e.shape))) / st_area (p.shape) &amp;gt;.15&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;--summarize by hashid&lt;/STRONG&gt;&lt;BR /&gt;GROUP BY hashid&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It works perfectly, but takes like 3 hours.&amp;nbsp; i have 30 of these to do every night.&amp;nbsp; Anything i can do to speed it up? Both layers have spatial indexes, and there are attribute indexes on both HASHID and FLD_ZONE fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This produces results like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHID&amp;nbsp; &amp;nbsp; FLOODZONE&lt;/P&gt;&lt;P&gt;124345&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AE,X&lt;/P&gt;&lt;P&gt;124346&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;X&lt;/P&gt;&lt;P&gt;124347&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AE,B,X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HASHID&amp;nbsp; &amp;nbsp; FLOODZONE&lt;/P&gt;&lt;P&gt;124345&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AE&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;124345&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;X&lt;/P&gt;&lt;P&gt;124346&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;X&lt;/P&gt;&lt;P&gt;124347&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AE&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;124347&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;B&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;124347&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;X&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 19:22:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806288#M2900</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2018-08-08T19:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806289#M2901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My guess on the time would be related to the number of spatial functions that have to run to calculate what is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How many FLOODZONE and PARCEL polys are we talking about?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the end result, what if you remove the "&lt;SPAN style="background-color: #ffffff;"&gt;GROUP BY hashid" would it give you the output format that you are looking for?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Just as a comparison, have you created a Python script to do the same process and see how long that takes to run?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 19:36:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806289#M2901</guid>
      <dc:creator>George_Thompson</dc:creator>
      <dc:date>2018-08-08T19:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806290#M2902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its a county.&amp;nbsp; 230k parcels.&amp;nbsp; 7832 floodzones.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The group by parcelid is necessary for LISTAGG to group the results&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not done in python as I am unaware of an equivalent python capability&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 19:49:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806290#M2902</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2018-08-08T19:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806291#M2903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I helped develop a tool that did something like the FEMA Changes Since Last Firm (at a previous job) and it would take at least 45 min - 1 hour to run and we did not have that many parcels and/or the calculation of the 15% overlap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe someone has a trick up their sleeve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a reason that you have to run it every night?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you remove the unshaded X areas and only use the SFHA and X-shaded (0.2%)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 19:55:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806291#M2903</guid>
      <dc:creator>George_Thompson</dc:creator>
      <dc:date>2018-08-08T19:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806292#M2904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is just one 30 overlays we need to do.&amp;nbsp; Parcels update nightly from the PAO, so we are trying to update the overlays.&amp;nbsp; Right now we do those once a month, but new parcels do not pick up the overlays until that runs, so we were trying to do it in sync with the parcel updates.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 20:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806292#M2904</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2018-08-08T20:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806293#M2905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I thought that might be the case. That is a lot of processing to run.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does the Oracle DB resources look like when the process is running?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is the process kicked off from?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you put the data into a new feature class?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 20:09:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806293#M2905</guid>
      <dc:creator>George_Thompson</dc:creator>
      <dc:date>2018-08-08T20:09:33Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806294#M2906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried to write as little as possible so its actually just a two column table, no shape.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORACLE is pinned.&amp;nbsp; Linux box is smokin'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Process currently kicked off from TOAD.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 20:23:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806294#M2906</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2018-08-08T20:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806295#M2907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That could be part of the reason for the time it takes to complete. Especially if the Linux box is smokin'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any way to get more resources to that box or move the data to another box that has more resources available, long shot I know?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Aug 2018 20:25:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806295#M2907</guid>
      <dc:creator>George_Thompson</dc:creator>
      <dc:date>2018-08-08T20:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize SQL query using ST_GEOMETRY</title>
      <link>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806296#M2908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Take two polygon layers, overlay/intersect them, and where they intersect, summarize the attributes of the overlay to a aggregate list if the area of intersection is more than 15% of the source poly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;You have already laid out the overall geoprocessing steps, you just need to script them out.&amp;nbsp; The most expensive step will be the intersection at the start, knowing how long it takes to &lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/tools/analysis-toolbox/intersect.htm" title="http://desktop.arcgis.com/en/arcmap/latest/tools/analysis-toolbox/intersect.htm"&gt;Intersect—Help | ArcGIS Desktop&lt;/A&gt; the two layers will tell you whether it is worth pursuing scripting it out vs using SQL.&amp;nbsp; So, how long does it take?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2018 13:01:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/geodatabase-questions/optimize-sql-query-using-st-geometry/m-p/806296#M2908</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2018-08-09T13:01:39Z</dc:date>
    </item>
  </channel>
</rss>

