<?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>idea Improve performance of ST_PointN() function (SDE.ST_GEOMETRY in Oracle) in ArcGIS Enterprise Ideas</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-ideas/improve-performance-of-st-pointn-function-sde-st/idi-p/1162874</link>
    <description>&lt;P&gt;When troubleshooting performance issues with SDE.ST_GEOMETRY queries in Oracle 12c/18c, I’ve found that the&amp;nbsp;ST_PointN function is very slow when used in bulk (10x slower than many other ST_GEOMETRY functions).&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The ST_PointN function doesn’t seem do anything special. It’s not doing complex spatial analysis or anything like that; it just gets a specific point from the SHAPE blob. So I wonder if there might be an issue with how it’s designed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example, changing the the function so that it’s DETERMINISTIC might make it faster.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could Esri investigate/improve the performance of that function?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 10 Apr 2022 13:24:21 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2022-04-10T13:24:21Z</dc:date>
    <item>
      <title>Improve performance of ST_PointN() function (SDE.ST_GEOMETRY in Oracle)</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-ideas/improve-performance-of-st-pointn-function-sde-st/idi-p/1162874</link>
      <description>&lt;P&gt;When troubleshooting performance issues with SDE.ST_GEOMETRY queries in Oracle 12c/18c, I’ve found that the&amp;nbsp;ST_PointN function is very slow when used in bulk (10x slower than many other ST_GEOMETRY functions).&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The ST_PointN function doesn’t seem do anything special. It’s not doing complex spatial analysis or anything like that; it just gets a specific point from the SHAPE blob. So I wonder if there might be an issue with how it’s designed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example, changing the the function so that it’s DETERMINISTIC might make it faster.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could Esri investigate/improve the performance of that function?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2022 13:24:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-ideas/improve-performance-of-st-pointn-function-sde-st/idi-p/1162874</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-04-10T13:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Improve performance of ST_PointN() function (SDE.ST_GEOMETRY in Oracle)</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-ideas/improve-performance-of-st-pointn-function-sde-st/idc-p/1162875#M2800</link>
      <description>&lt;P&gt;For example, a query that generates rows for each vertex (3000 features):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;1    SELECT   a.ROAD_ID
2             ,b.NUMBERS VERTEX_INDEX
3             ,a.SDE.ST_X(SDE.ST_PointN(a.SHAPE, b.NUMBERS)) AS X
4             ,a.SDE.ST_Y(SDE.ST_PointN(a.SHAPE, b.NUMBERS)) AS Y
5    FROM     ROAD a
6             CROSS JOIN NUMBERS b
7    WHERE    b.NUMBERS &amp;lt;= SDE.ST_NumPoints(a.SHAPE)

----------------------------------------------------------------------------------------------------
| Id  | Operation           | Name                 | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
----------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |                      |  5996 |  1545K|       |   262   (1)| 00:00:01 |
|   1 |  MERGE JOIN         |                      |  5996 |  1545K|       |   262   (1)| 00:00:01 |
|   2 |   INDEX FULL SCAN   | R23715_SDE_ROWID_UK  |    30 |    90 |       |     1   (0)| 00:00:01 |
|*  3 |   SORT JOIN         |                      |  3997 |  1018K|  2392K|   261   (1)| 00:00:01 |
|   4 |    TABLE ACCESS FULL| ROAD                 |  3997 |  1018K|       |    34   (0)| 00:00:01 |
----------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------
"   3 - access(""B"".""NUMBERS""&amp;lt;=""SDE"".""ST_NumPoints""(""A"".""SHAPE""))"
"       filter(""B"".""NUMBERS""&amp;lt;=""SDE"".""ST_NumPoints""(""A"".""SHAPE""))"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That query takes 30 seconds to run, which is far too long. In comparison, pretty much any other query on the FC runs instantly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Testing/benchmarking:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I created two tables (both contain 10,000 rows): ROADS_BM and ROADS_STARTPOINT_BM. I ran simple queries on the tables using each of the functions that are involved. Here are the results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="sql"&gt;               +-----------+------------------+---------------------------------------------------------------------------+
               | TIME(sec) | RETURN TYPE      | QUERY                                                                     |
+--------------+-----------+------------------+---------------------------------------------------------------------------+
| ST_X         | &amp;lt; 0.5     | Double precision | SELECT ROAD_ID FROM (                                                     |
|              |           | (Number)         | SELECT ROAD_ID, SDE.ST_X(SHAPE) AS X FROM ENG.ROADS_STARTPOINT_BM         |
|              |           |                  | ) WHERE X IS NOT NULL ORDER BY ROAD_ID                                    |
+--------------+-----------+------------------+---------------------------------------------------------------------------+
| ST_Y         | &amp;lt; 0.5     | Double precision | SELECT ROAD_ID FROM (                                                     |
|              |           | (Number)         | SELECT ROAD_ID, SDE.ST_Y(SHAPE) AS Y FROM ENG.ROADS_STARTPOINT_BM         |
|              |           |                  | ) WHERE Y IS NOT NULL ORDER BY ROAD_ID                                    |
+--------------+-----------+------------------+---------------------------------------------------------------------------+
| ST_NumPoints | &amp;lt; 0.5     | Integer          | SELECT ROAD_ID FROM (                                                     |
|              |           |                  | SELECT ROAD_ID, SDE.ST_NumPoints(SHAPE) AS NUM_POINTS FROM ENG.ROADS_BM   |
|              |           |                  | ) WHERE NUM_POINTS IS NOT NULL ORDER BY ROAD_ID                           |
+--------------+-----------+------------------+---------------------------------------------------------------------------+
| ST_PointN*   | **9.5**   | ST_POINT         | SELECT ROAD_ID FROM (                                                     |
|              |           | (ST_GEOMETRY     | SELECT ROAD_ID, SDE.ST_PointN(SHAPE,1) AS ST_POINT FROM ENG.ROADS_BM      |
|              |           | subclass)        | ) WHERE ST_POINT IS NOT NULL ORDER BY ROAD_ID                             |
+--------------+-----------+------------------+---------------------------------------------------------------------------+&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Function documentation: &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/st-x.htm" target="_blank" rel="nofollow noopener noreferrer"&gt;ST_X&lt;/A&gt;, &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/st-y.htm" target="_blank" rel="nofollow noopener noreferrer"&gt;ST_Y&lt;/A&gt;, &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/st-numpoints.htm" target="_blank" rel="nofollow noopener noreferrer"&gt;ST_NumPoints&lt;/A&gt;, &lt;A href="http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/st-pointn.htm" target="_blank" rel="nofollow noopener noreferrer"&gt;ST_PointN&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;The result? ST_PointN is the problem. Its 9.5 second response time is slow compared to the other functions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I think that proves that the performance of ST_PointN needs to be improved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Apr 2022 19:52:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-ideas/improve-performance-of-st-pointn-function-sde-st/idc-p/1162875#M2800</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2022-04-10T19:52:21Z</dc:date>
    </item>
  </channel>
</rss>

