Thanks, It indeed looks like its not using indexes. I'll have a go with it and let you know where I ended up.
SELECT DISTINCT ACTIVITY0.ACTIVITY_ID AS __C0, ACTIVITY0.SEQUENCENR AS __C1, ACTIVITY0.NAME_MLID AS __C2, ACTIVITY0.NAME AS __C3, ACTIVITY0.DESCRIPTION_MLID AS __C4, ACTIVITY0.DESCRIPTION AS __C5, ACTIVITY0.DURATIONUNIT_ENUMID AS __C6, ACTIVITY0.DURATION AS __C7, ACTIVITY0.REQUIRED AS __C8, ACTIVITY0.PREDECESSORTYPE_ENUMID AS __C9, ACTIVITY0.SUCCESSORTYPE_ENUMID AS __C10, ACTIVITY0.REMOVEFROMWORKLIST AS __C11, ACTIVITY0.LASTACTIVITY_ID AS __C12, ACTIVITY0.LIFECYCLEREPORTING AS __C13, ACTIVITY0.DUEDATE AS __C14, ACTIVITY0.PRIORITY_ENUMID AS __C15, ACTIVITY0.NOTIFY AS __C16, ACTIVITY0.TIMESTAMP AS __C17, ACTIVITY0.ACTIVITYTYPE_ID AS __C18, ACTIVITY0.CONTAINER_ID AS __C19, ACTIVITY0.REALIZATION_ID AS __C20, ACTIVITY0.KERNEL_ID AS __C21, ACTIVITY0.SYSREPOPERATION_ID AS __C22 FROM "Activity".ACTIVITY ACTIVITY0 /* "Activity".FI_ACTIVITY2: KERNEL_ID IS NULL */ /* WHERE (ACTIVITY0.KERNEL_ID IS NULL) AND (ACTIVITY0.REALIZATION_ID IS NULL) */ LEFT OUTER JOIN "Activity".ACTIVITYHISTORY ACTIVITYHISTORY0 /* "Activity".PK_ACTIVITYHISTORY: ACTIVITYHISTORY_ID = ACTIVITY0.LASTACTIVITY_ID */ ON ACTIVITYHISTORY0.ACTIVITYHISTORY_ID = ACTIVITY0.LASTACTIVITY_ID LEFT OUTER JOIN "Activity".ACTIVITYUSERACCOUNTROLE ACTIVITYUSERACCOUNTROLE0 /* "Activity".ACTIVITYUSERACCOUNTROLE.__SCAN_ */ ON ACTIVITYUSERACCOUNTROLE0.ACTIVITY_ID = ACTIVITY0.ACTIVITY_ID LEFT OUTER JOIN "Activity".ACTIVITYHISTORYUSERACCOUNT ACTIVITYHISTORYUSERACCOUNT0 /* "Activity".ACTIVITYHISTORYUSERACCOUNT.__SCAN_ */ ON ACTIVITYHISTORYUSERACCOUNT0.ACTIVITYHISTORY_ID = ACTIVITYHISTORY0.ACTIVITYHISTORY_ID WHERE ((NOT (ACTIVITYHISTORY0.ACTIVITYSTATE_ENUMID IN(37, 30, 463, 33, 464))) AND ((ACTIVITY0.KERNEL_ID IS NULL) AND (ACTIVITY0.REALIZATION_ID IS NULL))) AND ((ACTIVITYHISTORYUSERACCOUNT0.USERACCOUNT_ID = 600301) OR ((ACTIVITYUSERACCOUNTROLE0.USERACCOUNTROLE_ID IN(1, 3)) AND ((ACTIVITY0.REMOVEFROMWORKLIST = 0) OR (ACTIVITYHISTORYUSERACCOUNT0.USERACCOUNT_ID IS NULL)))) SELECT DISTINCT __C0 AS ACTIVITY_ID, __C1 AS SEQUENCENR, __C2 AS NAME_MLID, __C3 AS NAME, __C4 AS DESCRIPTION_MLID, __C5 AS DESCRIPTION, __C6 AS DURATIONUNIT_ENUMID, __C7 AS DURATION, __C8 AS REQUIRED, __C9 AS PREDECESSORTYPE_ENUMID, __C10 AS SUCCESSORTYPE_ENUMID, __C11 AS REMOVEFROMWORKLIST, __C12 AS LASTACTIVITY_ID, __C13 AS LIFECYCLEREPORTING, __C14 AS DUEDATE, __C15 AS PRIORITY_ENUMID, __C16 AS NOTIFY, __C17 AS TIMESTAMP, __C18 AS ACTIVITYTYPE_ID, __C19 AS CONTAINER_ID, __C20 AS REALIZATION_ID, __C21 AS KERNEL_ID, __C22 AS SYSREPOPERATION_ID FROM PUBLIC.__T0 /* "Activity"."merge_scan" */ br jan -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Unexpected-performance-issue-with-SQL-query-followed-by-error-tp4726p4845.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.