QUERY PLAN
Aggregate (cost=28.88..28.89 rows=1 width=8)
-> Sort (cost=28.68..28.72 rows=13 width=238)
Sort Key: r.created_at DESC
-> Group (cost=28.38..28.44 rows=13 width=238)
Group Key: r.id
-> Sort (cost=28.38..28.41 rows=13 width=12)
Sort Key: r.id
-> Hash Right Join (cost=18.56..28.14 rows=13 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=18.40..18.40 rows=13 width=12)
-> Seq Scan on tbl_erp_ticket_change_logs r (cost=0.00..18.40 rows=13 width=12)
Filter: (ticket_type = '20006'::smallint)