QUERY PLAN
Aggregate (cost=69.55..69.56 rows=1 width=8)
-> Sort (cost=61.67..62.98 rows=525 width=238)
Sort Key: r.created_at DESC
-> HashAggregate (cost=32.70..37.95 rows=525 width=238)
Group Key: r.id
-> Hash Right Join (cost=21.81..31.39 rows=525 width=12)
Hash Cond: (rvr.erp_ticket_change_log_id = r.id)
-> Seq Scan on tbl_erp_ticket_change_log_handlers rvr (cost=0.00..8.20 rows=520 width=4)
-> Hash (cost=15.25..15.25 rows=525 width=12)
-> Seq Scan on tbl_erp_ticket_change_logs r (cost=0.00..15.25 rows=525 width=12)