<?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 Archive classes do not utilize spatial indexes. in Data Management Questions</title>
    <link>https://community.esri.com/t5/data-management-questions/archive-classes-do-not-utilize-spatial-indexes/m-p/444831#M25412</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would anyone know why spatial indexes are not being utilized when I load an archive feature class?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using ArcGIS Desktop/Server 10.2.1, I have a PostgreSQL 9.2 instance hosting a 10.2.1 enterprise geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my database, I have some relatively large feature classes (millions of records per feature class).&amp;nbsp; When I load the default view of a versioned feature class into ArcMap, and zoom in to a small region on the map, the features render very fast.&amp;nbsp; With the Geodatabase History toolbar, I can then add the archive class to the map for the same feature class, the same spatial extent will take a very long time to refresh.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have logged the statements being issued to the underlying database, and it seems pretty clear to me that the entire table is being scanned every time ArcMap refreshes the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's what the database log looks like when the default view is refreshed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
2014-01-24 14:39:42 EST LOG:&amp;nbsp; execute sde_1390592382_0_4402: SELECT table_name, time_last_modified FROM sde.sde_tables_modified
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592382_0_4402
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592382_0_4404
2014-01-24 14:39:42 EST LOG:&amp;nbsp; execute sde_1390592382_0_4404: DECLARE sdecur_4404_16241 BINARY CURSOR WITH HOLD FOR&amp;nbsp; select&amp;nbsp; V__32.shape,&amp;nbsp; objectid,&amp;nbsp; representation,&amp;nbsp; override&amp;nbsp; from ( &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;&lt;STRONG&gt;{very_long_sql_statement}&lt;/STRONG&gt;&lt;/SPAN&gt; ) V__32&amp;nbsp; where&amp;nbsp; ((V__32.shape &amp;amp;&amp;amp; $7) = 't') 
2014-01-24 14:39:42 EST DETAIL:&amp;nbsp; parameters: $1 = '18029', $2 = '18047', $3 = '18029', $4 = '18047', $5 = '18029', $6 = '18047', $7 = '380000000500000008001000E610000020000000000000009BA3A78092108FECAD96921A9AEA98020000A9869C01DAEA98020000E9869C01'
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: FETCH FORWARD 100 from sdecur_4404_16241
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_4404_16241
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: CLOSE sdecur_4404_16241
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592382_0_4404
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is easy to spot the geometry being passed into the statement as parameter '$7', which I believe is the map extent being used to limit the query results to just include features that should be currently visible in the display.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, when the archive class is refreshed at the same map extent, the logged statements look like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
2014-01-24 14:38:31 EST LOG:&amp;nbsp; execute sde_1390592311_0_4394: SELECT table_name, time_last_modified FROM sde.sde_tables_modified
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592311_0_4394
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592311_0_4396
2014-01-24 14:38:31 EST LOG:&amp;nbsp; execute sde_1390592311_0_4396: DECLARE sdecur_4396_16241 BINARY CURSOR WITH HOLD FOR&amp;nbsp; select&amp;nbsp; buildings_h.shape&amp;nbsp; from&amp;nbsp; test.SDE.BUILDINGS_H&amp;nbsp; 
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: FETCH FORWARD 100 from sdecur_4396_16241
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_4396_16241
&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;&lt;STRONG&gt;... many more 'fetch forward' statements ...&lt;/STRONG&gt;&lt;/SPAN&gt;
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_4396_16241
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: CLOSE sdecur_4396_16241
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592311_0_4396
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: COMMIT
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: BEGIN
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: COMMIT
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: BEGIN
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I add up all of the 'fetch forward' statements (1000 records each), the total is equivalent to the number of records in the table.&amp;nbsp; I'm not sure if maybe I've done something wrong, but I definitely don't want this to be happening...it takes about 10-15 seconds just for the one feature class in this case, every time the map refreshes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have found a workaround.&amp;nbsp; I created a database view of the archive feature class (with a simple definition specified as 'select * from tablename_h').&amp;nbsp; When I load that view into ArcMap, and answer the prompt for the objectid field (for which I pick gdb_archive_oid), it appears ArcMap will use a spatial extent to limit features when it queries the view:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
2014-01-24 15:16:19 EST LOG:&amp;nbsp; execute sde_1390594579_0_17731: SELECT lineage_name, time_last_modified FROM sde.sde_lineages_modified WHERE lineage_name = $1
2014-01-24 15:16:19 EST DETAIL:&amp;nbsp; parameters: $1 = '-1'
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390594579_0_17731
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: SAVEPOINT sp_sde_1390594579_0_17730
2014-01-24 15:16:19 EST LOG:&amp;nbsp; execute sde_1390594579_0_17730: DECLARE sdecur_17730_16241 BINARY CURSOR WITH HOLD FOR&amp;nbsp; select shape from ( &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;&lt;STRONG&gt;{very_long_sql_statement}&lt;/STRONG&gt;&lt;/SPAN&gt;) a where (shape &amp;amp;&amp;amp; sde.ST_GeomFromWKB($1,$2)) = 't'
2014-01-24 15:16:19 EST DETAIL:&amp;nbsp; parameters: $1 = '\x0103000000010000000500000064bd625724ad5ec0d85e3b20e28e484064bd625724ad5ec0c06768ccfc8e4840309eba520cad5ec0c06768ccfc8e4840309eba520cad5ec0d85e3b20e28e484064bd625724ad5ec0d85e3b20e28e4840', $2 = '4326'
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: FETCH FORWARD 100 from sdecur_17730_16241
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: RELEASE SAVEPOINT sp_sde_1390594579_0_17730
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_17730_16241
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: CLOSE sdecur_17730_16241
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390594579_0_17730
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point, I have two questions.&amp;nbsp; First, is this a known/expected behaviour of ArcGIS when working with archive classes, or might it be considered a bug?&amp;nbsp; Second, is there any inherent problem with the workaround of using a view?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:53:08 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-11T19:53:08Z</dc:date>
    <item>
      <title>Archive classes do not utilize spatial indexes.</title>
      <link>https://community.esri.com/t5/data-management-questions/archive-classes-do-not-utilize-spatial-indexes/m-p/444831#M25412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Would anyone know why spatial indexes are not being utilized when I load an archive feature class?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using ArcGIS Desktop/Server 10.2.1, I have a PostgreSQL 9.2 instance hosting a 10.2.1 enterprise geodatabase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my database, I have some relatively large feature classes (millions of records per feature class).&amp;nbsp; When I load the default view of a versioned feature class into ArcMap, and zoom in to a small region on the map, the features render very fast.&amp;nbsp; With the Geodatabase History toolbar, I can then add the archive class to the map for the same feature class, the same spatial extent will take a very long time to refresh.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have logged the statements being issued to the underlying database, and it seems pretty clear to me that the entire table is being scanned every time ArcMap refreshes the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's what the database log looks like when the default view is refreshed:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
2014-01-24 14:39:42 EST LOG:&amp;nbsp; execute sde_1390592382_0_4402: SELECT table_name, time_last_modified FROM sde.sde_tables_modified
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592382_0_4402
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592382_0_4404
2014-01-24 14:39:42 EST LOG:&amp;nbsp; execute sde_1390592382_0_4404: DECLARE sdecur_4404_16241 BINARY CURSOR WITH HOLD FOR&amp;nbsp; select&amp;nbsp; V__32.shape,&amp;nbsp; objectid,&amp;nbsp; representation,&amp;nbsp; override&amp;nbsp; from ( &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;&lt;STRONG&gt;{very_long_sql_statement}&lt;/STRONG&gt;&lt;/SPAN&gt; ) V__32&amp;nbsp; where&amp;nbsp; ((V__32.shape &amp;amp;&amp;amp; $7) = 't') 
2014-01-24 14:39:42 EST DETAIL:&amp;nbsp; parameters: $1 = '18029', $2 = '18047', $3 = '18029', $4 = '18047', $5 = '18029', $6 = '18047', $7 = '380000000500000008001000E610000020000000000000009BA3A78092108FECAD96921A9AEA98020000A9869C01DAEA98020000E9869C01'
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: FETCH FORWARD 100 from sdecur_4404_16241
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_4404_16241
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: CLOSE sdecur_4404_16241
2014-01-24 14:39:42 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592382_0_4404
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is easy to spot the geometry being passed into the statement as parameter '$7', which I believe is the map extent being used to limit the query results to just include features that should be currently visible in the display.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, when the archive class is refreshed at the same map extent, the logged statements look like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
2014-01-24 14:38:31 EST LOG:&amp;nbsp; execute sde_1390592311_0_4394: SELECT table_name, time_last_modified FROM sde.sde_tables_modified
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592311_0_4394
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592311_0_4396
2014-01-24 14:38:31 EST LOG:&amp;nbsp; execute sde_1390592311_0_4396: DECLARE sdecur_4396_16241 BINARY CURSOR WITH HOLD FOR&amp;nbsp; select&amp;nbsp; buildings_h.shape&amp;nbsp; from&amp;nbsp; test.SDE.BUILDINGS_H&amp;nbsp; 
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: FETCH FORWARD 100 from sdecur_4396_16241
2014-01-24 14:38:31 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_4396_16241
&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;&lt;STRONG&gt;... many more 'fetch forward' statements ...&lt;/STRONG&gt;&lt;/SPAN&gt;
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_4396_16241
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: CLOSE sdecur_4396_16241
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390592311_0_4396
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: COMMIT
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: BEGIN
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: COMMIT
2014-01-24 14:38:43 EST LOG:&amp;nbsp; statement: BEGIN
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I add up all of the 'fetch forward' statements (1000 records each), the total is equivalent to the number of records in the table.&amp;nbsp; I'm not sure if maybe I've done something wrong, but I definitely don't want this to be happening...it takes about 10-15 seconds just for the one feature class in this case, every time the map refreshes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have found a workaround.&amp;nbsp; I created a database view of the archive feature class (with a simple definition specified as 'select * from tablename_h').&amp;nbsp; When I load that view into ArcMap, and answer the prompt for the objectid field (for which I pick gdb_archive_oid), it appears ArcMap will use a spatial extent to limit features when it queries the view:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
2014-01-24 15:16:19 EST LOG:&amp;nbsp; execute sde_1390594579_0_17731: SELECT lineage_name, time_last_modified FROM sde.sde_lineages_modified WHERE lineage_name = $1
2014-01-24 15:16:19 EST DETAIL:&amp;nbsp; parameters: $1 = '-1'
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390594579_0_17731
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: SAVEPOINT sp_sde_1390594579_0_17730
2014-01-24 15:16:19 EST LOG:&amp;nbsp; execute sde_1390594579_0_17730: DECLARE sdecur_17730_16241 BINARY CURSOR WITH HOLD FOR&amp;nbsp; select shape from ( &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;&lt;STRONG&gt;{very_long_sql_statement}&lt;/STRONG&gt;&lt;/SPAN&gt;) a where (shape &amp;amp;&amp;amp; sde.ST_GeomFromWKB($1,$2)) = 't'
2014-01-24 15:16:19 EST DETAIL:&amp;nbsp; parameters: $1 = '\x0103000000010000000500000064bd625724ad5ec0d85e3b20e28e484064bd625724ad5ec0c06768ccfc8e4840309eba520cad5ec0c06768ccfc8e4840309eba520cad5ec0d85e3b20e28e484064bd625724ad5ec0d85e3b20e28e4840', $2 = '4326'
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: FETCH FORWARD 100 from sdecur_17730_16241
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: RELEASE SAVEPOINT sp_sde_1390594579_0_17730
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: FETCH FORWARD 1000 from sdecur_17730_16241
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: CLOSE sdecur_17730_16241
2014-01-24 15:16:19 EST LOG:&amp;nbsp; statement: DEALLOCATE sde_1390594579_0_17730
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At this point, I have two questions.&amp;nbsp; First, is this a known/expected behaviour of ArcGIS when working with archive classes, or might it be considered a bug?&amp;nbsp; Second, is there any inherent problem with the workaround of using a view?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:53:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-management-questions/archive-classes-do-not-utilize-spatial-indexes/m-p/444831#M25412</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T19:53:08Z</dc:date>
    </item>
  </channel>
</rss>

