QUERY PLAN
Aggregate (cost=28.92..28.93 rows=1 width=8)
-> Sort (cost=28.81..28.83 rows=7 width=193)
Sort Key: r.created_at DESC
-> Group (cost=20.46..28.72 rows=7 width=193)
Group Key: r.id
-> Nested Loop (cost=20.46..28.70 rows=7 width=12)
-> Merge Left Join (cost=20.46..20.52 rows=7 width=16)
Merge Cond: (r.id = crvr.punch_repair_id)
-> Sort (cost=19.38..19.40 rows=7 width=16)
Sort Key: r.id
-> Hash Right Join (cost=11.91..19.28 rows=7 width=16)
Hash Cond: (rccr.punch_repair_id = r.id)
Filter: ((r.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1017,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5296,5300,5311,5329,5332,5360,5388,5404,5420,5440,5445,5446}'::integer[])) OR (rccr.user_id = 1000) OR (rvr.user_id = 1000))
-> Seq Scan on tbl_punch_repair_carbon_copy_rels rccr (cost=0.00..5.33 rows=333 width=8)
-> Hash (cost=11.79..11.79 rows=10 width=20)
-> Hash Right Join (cost=6.94..11.79 rows=10 width=20)
Hash Cond: (rvr.punch_repair_id = r.id)
-> Seq Scan on tbl_punch_repair_verify_rels rvr (cost=0.00..4.25 rows=225 width=8)
-> Hash (cost=6.81..6.81 rows=10 width=16)
-> Seq Scan on tbl_punch_repairs r (cost=0.00..6.81 rows=10 width=16)
Filter: (created_by = 5329)
-> Sort (cost=1.08..1.09 rows=4 width=4)
Sort Key: crvr.punch_repair_id
-> Seq Scan on tbl_punch_repair_cancel_verify_rels crvr (cost=0.00..1.04 rows=4 width=4)
-> Materialize (cost=0.00..8.09 rows=1 width=4)
-> Seq Scan on tbl_users u (cost=0.00..8.09 rows=1 width=4)
Filter: ((id = 5329) AND (department_id = 1))