QUERY PLAN
Aggregate (cost=71.54..71.55 rows=1 width=8)
-> Sort (cost=71.52..71.52 rows=1 width=390)
Sort Key: r.created_at DESC
-> Group (cost=71.50..71.51 rows=1 width=390)
Group Key: r.id
-> Sort (cost=71.50..71.51 rows=1 width=12)
Sort Key: r.id
-> Hash Right Join (cost=48.14..71.49 rows=1 width=12)
Hash Cond: (rvr.erp_payment_ticket_id = r.id)
-> Seq Scan on tbl_erp_payment_ticket_verify_rels rvr (cost=0.00..19.70 rows=970 width=4)
-> Hash (cost=48.13..48.13 rows=1 width=12)
-> Nested Loop (cost=0.28..48.13 rows=1 width=12)
-> Seq Scan on tbl_erp_payment_ticket_settles eptss (cost=0.00..39.83 rows=1 width=4)
Filter: (purchase_contract_id = 4079)
-> Index Scan using tbl_erp_payment_tickets_pkey on tbl_erp_payment_tickets r (cost=0.28..8.30 rows=1 width=12)
Index Cond: (id = eptss.erp_payment_ticket_id)