QUERY PLAN
Aggregate (cost=87.19..87.20 rows=1 width=8)
-> Sort (cost=86.60..86.70 rows=39 width=238)
Sort Key: r.created_at DESC
-> HashAggregate (cost=85.18..85.57 rows=39 width=238)
Group Key: r.id
-> Hash Join (cost=30.21..85.08 rows=39 width=12)
Hash Cond: (r.id = rvr.erp_ticket_change_log_id)
-> Seq Scan on tbl_erp_ticket_change_logs r (cost=0.00..40.24 rows=1424 width=12)
-> Hash (cost=29.73..29.73 rows=39 width=4)
-> Seq Scan on tbl_erp_ticket_change_log_handlers rvr (cost=0.00..29.73 rows=39 width=4)
Filter: (user_id = 1004)