QUERY PLAN
Aggregate (cost=51.86..51.87 rows=1 width=8)
-> Sort (cost=49.49..49.89 rows=158 width=193)
Sort Key: r.created_at DESC
-> HashAggregate (cost=42.14..43.72 rows=158 width=193)
Group Key: r.id
-> Hash Left Join (cost=17.75..41.75 rows=158 width=12)
Hash Cond: (r.id = crvr.punch_repair_id)
-> Hash Left Join (cost=16.66..40.03 rows=158 width=12)
Hash Cond: (r.id = rvr.punch_repair_id)
Filter: ((r.created_by = ANY ('{1000,1001,1004,1005,1011,1013,1015,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5388,5446,5449}'::integer[])) OR (rccr.user_id = 1000) OR (rvr.user_id = 1000))
-> Hash Right Join (cost=9.33..15.74 rows=348 width=20)
Hash Cond: (rccr.punch_repair_id = r.id)
-> Seq Scan on tbl_punch_repair_carbon_copy_rels rccr (cost=0.00..5.48 rows=348 width=8)
-> Hash (cost=6.37..6.37 rows=237 width=16)
-> Seq Scan on tbl_punch_repairs r (cost=0.00..6.37 rows=237 width=16)
-> Hash (cost=4.37..4.37 rows=237 width=8)
-> Seq Scan on tbl_punch_repair_verify_rels rvr (cost=0.00..4.37 rows=237 width=8)
-> Hash (cost=1.04..1.04 rows=4 width=4)
-> Seq Scan on tbl_punch_repair_cancel_verify_rels crvr (cost=0.00..1.04 rows=4 width=4)