<?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 performance issue with candidate tasks in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94497#M64735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am testing Activiti framework from performance perspective. Actually I found problem with candidate tasks query performance if I have about 300 000 process instance in database. Problem is with this lines of code where I want to find out CANDIDATE tasks for concrete user:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;org.activiti.engine.TaskService taskService = processEngine.getTaskService();&lt;BR /&gt;TaskQuery taskQuery = taskService.createTaskQuery();&lt;BR /&gt;taskQuery = taskQuery.taskCandidateUser(userId).orderByTaskCreateTime().asc();&lt;BR /&gt;List&amp;lt;org.activiti.engine.task.Task&amp;gt; list = taskQuery.listPage(0, MAX_TASKS_RESULTS);&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This generates this&amp;nbsp; DB select:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;SELECT DISTINCT t. *&lt;BR /&gt;FROM act_ru_task t&lt;BR /&gt;INNER JOIN act_ru_identitylink i&lt;BR /&gt;ON i.task_id_&amp;nbsp;&amp;nbsp;&amp;nbsp; = t.id_&lt;BR /&gt;WHERE i.type_&amp;nbsp;&amp;nbsp;&amp;nbsp; = 'candidate'&lt;BR /&gt;AND i.group_id_ IN ( 'DISPATCHER' )&lt;BR /&gt;AND t.assignee_ IS NULL&lt;BR /&gt;ORDER BY t.create_time_ ASC&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This query is executed about 8 seconds. I am using Activiti 5.9 with Oracle 11g database on Linux machines. All other queries are executed within milliseconds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to found out where the problem is and it is with &lt;/SPAN&gt;&lt;EM&gt;IS NULL&lt;/EM&gt;&lt;SPAN&gt; condition in &lt;/SPAN&gt;&lt;EM&gt;assignee_&lt;/EM&gt;&lt;SPAN&gt; column. If I changed condition in SQL to &lt;/SPAN&gt;&lt;EM&gt;IS NOT NULL&lt;/EM&gt;&lt;SPAN&gt; or &lt;/SPAN&gt;&lt;EM&gt;= '1'&lt;/EM&gt;&lt;SPAN&gt; the query is executed in milliseconds. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I realized that the problem is only with candidate tasks where assignee is not set &lt;/SPAN&gt;&lt;EM&gt;(IS NULL)&lt;/EM&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have some solution to fix it?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Apr 2012 10:50:23 GMT</pubDate>
    <dc:creator>miroslav_slobod</dc:creator>
    <dc:date>2012-04-03T10:50:23Z</dc:date>
    <item>
      <title>performance issue with candidate tasks</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94497#M64735</link>
      <description>Hello,I am testing Activiti framework from performance perspective. Actually I found problem with candidate tasks query performance if I have about 300 000 process instance in database. Problem is with this lines of code where I want to find out CANDIDATE tasks for concrete user&lt;IMG id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://migration33.stage.lithium.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;rg.activiti.engine.</description>
      <pubDate>Tue, 03 Apr 2012 10:50:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94497#M64735</guid>
      <dc:creator>miroslav_slobod</dc:creator>
      <dc:date>2012-04-03T10:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue with candidate tasks</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94498#M64736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Interesting. Could it be some sort of index problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you compare the Oracle query path between the ASSIGNEE IS NULL and the ASSIGNEE IS NOT NULL query statements?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 11:20:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94498#M64736</guid>
      <dc:creator>trademak</dc:creator>
      <dc:date>2012-04-03T11:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue with candidate tasks</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94499#M64737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not a database expert, but I tried to add some database indexes - performance did not improve. There are attached two explain plans from Oracle SQL Developer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure if this is what you requested.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 08:57:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94499#M64737</guid>
      <dc:creator>miroslav_slobod</dc:creator>
      <dc:date>2012-04-04T08:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue with candidate tasks</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94500#M64738</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Some idea?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 10:23:37 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94500#M64738</guid>
      <dc:creator>miroslav_slobod</dc:creator>
      <dc:date>2012-04-10T10:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue with candidate tasks</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94501#M64739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Interesting, we're using Oracle as well so i had a look into this. It turns out that Oracle does not always use the index for a NULL column value in the where clause. See here &lt;/SPAN&gt;&lt;A href="http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search" rel="nofollow noopener noreferrer"&gt;http://stackoverflow.com/questions/1017239/how-do-null-values-affect-performance-in-a-database-search&lt;/A&gt;&lt;SPAN&gt;. It says that you could solve the problem by adding a constant to the index:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;CREATE INDEX idx_null ON test(object_id, 1);&lt;/CODE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 06:26:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94501#M64739</guid>
      <dc:creator>heymjo</dc:creator>
      <dc:date>2012-05-03T06:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: performance issue with candidate tasks</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94502#M64740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great catch…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 19:49:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/performance-issue-with-candidate-tasks/m-p/94502#M64740</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2012-05-03T19:49:24Z</dc:date>
    </item>
  </channel>
</rss>

