QUERY PLAN
Aggregate (cost=114.14..114.15 rows=1 width=8)
-> Sort (cost=104.09..105.77 rows=670 width=238)
Sort Key: r.created_at DESC
-> HashAggregate (cost=65.94..72.64 rows=670 width=238)
Group Key: r.id
-> Hash Right Join (cost=25.07..60.84 rows=2040 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..30.40 rows=2040 width=4)
-> Hash (cost=16.70..16.70 rows=670 width=12)
-> Seq Scan on tbl_erp_ticket_change_logs r (cost=0.00..16.70 rows=670 width=12)