QUERY PLAN
GroupAggregate (cost=1904.47..1906.58 rows=92 width=44)
Group Key: c.project_id
-> Sort (cost=1904.47..1904.71 rows=96 width=20)
Sort Key: c.project_id
-> Hash Left Join (cost=165.25..1901.31 rows=96 width=20)
Hash Cond: (c.id = i.case_id)
-> Seq Scan on tbl_cases c (cost=0.00..1735.81 rows=96 width=8)
Filter: ((case_type = 1) AND (project_id = ANY ('{4175,4174,4173,4172,4171,4170,4169,4168,4167,4166,4164,4161,4158,4157,4155,4152,4151,4150,4144,4142,4127,4111,4098,4096,4086,4079,4078,4063,4057,4052,4014,3991,3950,3949,3927,3899,3886,3874,3872,3857,3855,3816,3813,3786,3767,3764,3760,3752,3751,3744,3723,3714,3686,3679,3661,3660,3653,3652,3644,3633,3623,3599,3591,3590,3589,3577,3576,3568,3552,3544,3515,3514,3513,3503,3467,3458,3441,3424,3372,3371,3318,3300,3281,3276,3274,3269,3265,3263,3251,3246,3235,3225,3216,3209,3208,3201,3195,3157,3148,3073,3027,3019,2939,2907,2893,2759,2695,2684,2530,2508,2507,2504,2459,2458,2422,2080,2079,1983,1963,1938,1929,1925,1791,1460,1240,1111,1018,986,983,887,884,883,861,778,764,88}'::integer[])))
-> Hash (cost=145.03..145.03 rows=1618 width=20)
-> Subquery Scan on i (cost=104.58..145.03 rows=1618 width=20)
-> HashAggregate (cost=104.58..128.85 rows=1618 width=20)
Group Key: tbl_pre_sales.case_id
-> Seq Scan on tbl_pre_sales (cost=0.00..88.30 rows=1628 width=24)
Filter: (NOT is_draft)