<?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: SQL Query Performance Issues in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420730#M45142</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.oracletutorial.com/oracle-basics/oracle-inner-join/" target="_blank" rel="noopener"&gt;Oracle INNER JOIN Demonstrated with Practical Examples (oracletutorial.com)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.oracletutorial.com/oracle-basics/oracle-left-join/" target="_blank"&gt;Oracle LEFT JOIN By Practical Examples (oracletutorial.com)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.oracletutorial.com/oracle-basics/oracle-right-join/" target="_blank"&gt;RIGHT OUTER JOIN in Oracle By Practical Examples (oracletutorial.com)&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 May 2024 21:19:01 GMT</pubDate>
    <dc:creator>MarceloMarques</dc:creator>
    <dc:date>2024-05-08T21:19:01Z</dc:date>
    <item>
      <title>SQL Query Performance Issues</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420549#M45139</link>
      <description>&lt;P&gt;We are setting up a new Oracle enterprise geodatabase. This set up involves an external procedure that runs on a weekly basis to update data on a table.&lt;/P&gt;&lt;P&gt;Part of this external procedure has a SQL query (below) to select a subset of data based on a spatial relationship using the ST_Intersects function. In our current environment, this statement takes less than a minute to run. In our new environment, we are encountering performance issues on the "&lt;STRONG&gt;AND t1.field2 != t2.field3&lt;/STRONG&gt;" portion of this statement - to the tune of it never completing. If we take this statement out of the query, the query runs fine, so we have been able to narrow this performance issue to this particular statement.&lt;/P&gt;&lt;P&gt;Both tables (Table1 and Table2 in the query below) have spatial indexes and attribute indexes associated with them.&lt;/P&gt;&lt;P&gt;Any ideas on what we could try to get this to successfully run?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;SELECT t1.field1, t1.field2, t2.field3 FROM Table1 t1, Table2 t2  
WHERE sde.st_intersects(t2.shape, sde.st_pointonsurface((t1.shape))) = 1
AND t1.field2 != t2.field3
AND t2.field3 != 'Attribute';&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks - Josh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 16:48:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420549#M45139</guid>
      <dc:creator>JoshBillings</dc:creator>
      <dc:date>2024-05-08T16:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query Performance Issues</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420553#M45140</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt;&amp;nbsp;- compare the &lt;STRONG&gt;Query Execution Plan&lt;/STRONG&gt; in the old server with the new server to determine what might be causing the problem.&lt;BR /&gt;&lt;BR /&gt;Make sure the new server has the esri st_geometry library properly installed and check if it is working.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/manage-oracle/configure-oracle-extproc.htm" target="_blank" rel="noopener"&gt;Configure extproc to access ST_Geometry in Oracle—ArcGIS Pro | Documentation&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You need to use the version of the esri st_geometry library that matches the version of the geodatabase arcsde repository.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 16:58:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420553#M45140</guid>
      <dc:creator>MarceloMarques</dc:creator>
      <dc:date>2024-05-08T16:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query Performance Issues</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420648#M45141</link>
      <description>&lt;P&gt;Placing join tables in the FROM list hasn't been best practice since Oracle 8.&lt;BR /&gt;I strongly urge you to use JOIN syntax.&amp;nbsp; And "!=" best written "&amp;lt;&amp;gt;".&amp;nbsp;&lt;/P&gt;&lt;P&gt;The optimizer might prefer placing the point in the first argument, but if Table2&lt;BR /&gt;is indexed on t2.field3, and that has higher selectivity, you might want to specify&lt;BR /&gt;the non-spatial constraints first (though NOT is usually an awful JOIN constraint).&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 18:56:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420648#M45141</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2024-05-08T18:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query Performance Issues</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420730#M45142</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/26942"&gt;@JoshBillings&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.oracletutorial.com/oracle-basics/oracle-inner-join/" target="_blank" rel="noopener"&gt;Oracle INNER JOIN Demonstrated with Practical Examples (oracletutorial.com)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.oracletutorial.com/oracle-basics/oracle-left-join/" target="_blank"&gt;Oracle LEFT JOIN By Practical Examples (oracletutorial.com)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.oracletutorial.com/oracle-basics/oracle-right-join/" target="_blank"&gt;RIGHT OUTER JOIN in Oracle By Practical Examples (oracletutorial.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 21:19:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420730#M45142</guid>
      <dc:creator>MarceloMarques</dc:creator>
      <dc:date>2024-05-08T21:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Query Performance Issues</title>
      <link>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420747#M45143</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Edit:&lt;/STRONG&gt; Never mind. The syntax is the same as your query.&lt;/P&gt;&lt;P&gt;As a last resort, you could try using the&amp;nbsp;&lt;SPAN&gt;&lt;I&gt;Select Layer by Location — Intersect (DBMS)&lt;/I&gt;&amp;nbsp;geoprocessing tool which creates a spatial SQL query in a database view. Maybe the syntax or performance would be different. You could steal the SQL from the view to use in your query.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Related:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-questions/select-layer-by-location-intersect-dbms-existing/m-p/1365269" target="_self"&gt;Select Layer by Location — Intersect (DBMS) — Existing Selections&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-enterprise-questions/intended-use-case-for-select-layer-by-location/m-p/1366117" target="_self"&gt;Intended use case for Select Layer by Location — Intersect (DBMS)?&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/select-layer-by-location-indicate-that-intersect/idi-p/1368199" target="_self"&gt;Select Layer By Location — Indicate that Intersect (DBMS) creates a database view&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/select-layer-by-location-intersect-dbms-user/idi-p/1365481" target="_self"&gt;Select Layer by Location — Intersect (DBMS) — User-defined output database view name&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/select-layer-by-location-intersect-dbms-create-a/idi-p/1365586" target="_self"&gt;Select Layer by Location — Intersect (DBMS) — Create a query layer instead of a database view&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/select-layer-by-location-intersect-dbms-show-sql/idi-p/1365598" target="_self"&gt;Select Layer by Location — Intersect (DBMS) — Show SQL query definition in GP tool details&lt;/A&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 08 May 2024 21:49:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/sql-query-performance-issues/m-p/1420747#M45143</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-05-08T21:49:48Z</dc:date>
    </item>
  </channel>
</rss>

