<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged sys_changed_chronos</title>
<link>https://overflow.efficy.io/?qa=tag/sys_changed_chronos</link>
<description>Powered by Question2Answer</description>
<item>
<title>indexes : SYS_CHANGED_CHRONOS vs SYS_CHANGED_CHRONOS2 performances</title>
<link>https://overflow.efficy.io/?qa=4939/syschangedchronos-syschangedchronos2-performances</link>
<description>&lt;p&gt;Hi everyone,&lt;/p&gt;

&lt;p&gt;before giving the context and my observations, here is my question : for what kind of queries the SYS&amp;#95;CHANGED&amp;#95;CHRONOS and SYS&amp;#95;CHANGED&amp;#95;CHRONOS2 indexes are created ?&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Yesterday, I observed that the chronos detail was really slow to load.&lt;/p&gt;

&lt;p&gt;In the query logs, the chronos detail has generated one query per selected entity (chronos detail options).&lt;br&gt;
The idea is to get the primary key of each entity linked to the entity.&lt;br&gt;
There is no other query in the logs about chronos detail.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;So, I guess, but I can’t confirm it without proof, that the primary keys from the previous queries are used by the following SYS&amp;#95;CHANGED queries :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;select K_TABLE, D_CHANGE, USERNAME, OPERATION, K_1, K_2, K_3, MILLI,
&quot;COMMENT&quot; from &quot;GERM&quot;.&quot;SYS_CHANGED&quot; where ((K_1 = :key and K_TABLE in
(:param1)) or (K_2 = :key and K_TABLE in (:param2, :param3, :param4)))
and (D_CHANGE &amp;gt;= :mindate) and (D_CHANGE &amp;lt; :maxdate) order by D_CHANGE,
K_TABLE, K_2, MILLI, OPERATION;
&lt;/code&gt;&lt;/pre&gt;

&lt;hr&gt;

&lt;pre&gt;&lt;code&gt;select distinct USERNAME, D_CHANGE from &quot;GERM&quot;.&quot;SYS_CHANGED&quot; where
((K_1 = :key and K_TABLE in (:param1)) or (K_2 = :key and K_TABLE in
(:param2, :param3, :param4))) and (D_CHANGE &amp;gt;= :mindate) and (D_CHANGE
&amp;lt; :maxdate) order by D_CHANGE DESC;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Each of these queries exists in a lot of versions because of a variation in the number of parameters for K&amp;#95;TABLE field.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;When I consult the execution plan of the above queries (Oracle - SQL Developer), I observe that the first one is using SYS&amp;#95;CHANGED_CHRONOS (K&amp;#95;2, K&amp;#95;TABLE, D&amp;#95;CHANGE, USERNAME) index and the second one, SYS&amp;#95;CHANGED&amp;#95;CHRONOS2 (D&amp;#95;CHANGE, K&amp;#95;TABLE, K&amp;#95;1, K&amp;#95;2) index.&lt;br&gt;
For each query, I can consult the execution plan with SYS&amp;#95;CHANGED&amp;#95;CHRONOS or SYS&amp;#95;CHANGED&amp;#95;CHRONOS2 index.&lt;br&gt;
The cost is almost the same between these two indexes. So, the choice between them seems to be a really complicated choice for Oracle.&lt;br&gt;
In the database, SYS&amp;#95;CHANGED&amp;#95;CHRONOS is better in a lot of situations.&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;So, for what kind of queries the SYS&amp;#95;CHANGED&amp;#95;CHRONOS and SYS&amp;#95;CHANGED&amp;#95;CHRONOS2 indexes are created ?&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;KR,&lt;/p&gt;

&lt;p&gt;Eric&lt;/p&gt;
</description>
<category>Database</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=4939/syschangedchronos-syschangedchronos2-performances</guid>
<pubDate>Tue, 22 Oct 2019 09:38:06 +0000</pubDate>
</item>
</channel>
</rss>