-- execution time 55 ms with 4700 records in table TABLE1 explain plan for select T0.* , T1.HIDE from TABLE1 as T0 left JOIN ( select key1, key2, count(*) AS HIDE from TABLE1 GROUP BY key1, key2 ) as T1 ON T0.key1 = T1.key1 AND T0.key2 = T1.key2; IgniteProject(INTERNALID=[$0], COLUMN1=[$1], COLUMN2=[$2], COLUMN3=[$3], COLUMN4=[$4], COLUMN5=[$5], COLUMN6=[$6], COLUMN7=[$7], COLUMN8=[$8], COLUMN9=[$9], COLUMN10=[$10], KEY1=[$11], KEY2=[$12], HIDE=[$15]): rowcount = 2438.46625, cumulative cost = IgniteCost [rowCount=18624.96625, cpu=143187.49839843236, memory=143893.0, io=0.0, network=0.0], id = 4889 IgniteMergeJoin(condition=[AND(=($11, $13), =($12, $14))], joinType=[left], variablesSet=[[]], leftCollation=[[11, 12]], rightCollation=[[0, 1]]): rowcount = 2438.46625, cumulative cost = IgniteCost [rowCount=16186.5, cpu=140749.03214843236, memory=143893.0, io=0.0, network=0.0], id = 4888 IgniteSort(sort0=[$11], sort1=[$12], dir0=[ASC], dir1=[ASC]): rowcount = 2398.0, cumulative cost = IgniteCost [rowCount=4796.0, cpu=60782.51607421618, memory=124696.0, io=0.0, network=0.0], id = 4885 IgniteTableScan(table=[[PUBLIC, TABLE1]], requiredColumns=[{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}]): rowcount = 2398.0, cumulative cost = IgniteCost [rowCount=2398.0, cpu=2398.0, memory=0.0, io=0.0, network=0.0], id = 3489 IgniteColocatedSortAggregate(group=[{0, 1}], HIDE=[COUNT()], collation=[[0, 1]]): rowcount = 1798.5, cumulative cost = IgniteCost [rowCount=7194.0, cpu=63180.51607421618, memory=19197.0, io=0.0, network=0.0], id = 4887 IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC]): rowcount = 2398.0, cumulative cost = IgniteCost [rowCount=4796.0, cpu=60782.51607421618, memory=19184.0, io=0.0, network=0.0], id = 4886 IgniteTableScan(table=[[PUBLIC, TABLE1]], requiredColumns=[{13, 14}]): rowcount = 2398.0, cumulative cost = IgniteCost [rowCount=2398.0, cpu=2398.0, memory=0.0, io=0.0, network=0.0], id = 3431