QUERY PLAN
Limit (cost=69.55..69.56 rows=1 width=249)
-> Sort (cost=69.55..69.56 rows=1 width=249)
Sort Key: r.created_at DESC
-> Group (cost=69.54..69.54 rows=1 width=249)
Group Key: r.id
-> Sort (cost=69.54..69.54 rows=1 width=249)
Sort Key: r.id
-> Hash Right Join (cost=46.18..69.53 rows=1 width=249)
Hash Cond: (rvr.erp_collect_ticket_id = r.id)
-> Seq Scan on tbl_erp_collect_ticket_verify_rels rvr (cost=0.00..19.70 rows=970 width=4)
-> Hash (cost=46.17..46.17 rows=1 width=249)
-> Nested Loop (cost=0.28..46.17 rows=1 width=249)
-> Seq Scan on tbl_erp_collect_ticket_settles ectss (cost=0.00..37.86 rows=1 width=4)
Filter: (purchase_contract_id = 4080)
-> Index Scan using tbl_erp_collect_tickets_pkey on tbl_erp_collect_tickets r (cost=0.28..8.29 rows=1 width=249)
Index Cond: (id = ectss.erp_collect_ticket_id)