QUERY PLAN
Sort (cost=407.89..407.99 rows=42 width=140)
Sort Key: "*SELECT* 1".id DESC
-> Result (cost=86.14..406.76 rows=42 width=140)
-> Append (cost=86.14..406.34 rows=42 width=108)
-> Subquery Scan on "*SELECT* 1" (cost=86.14..155.68 rows=20 width=94)
-> Hash Join (cost=86.14..155.48 rows=20 width=98)
Hash Cond: (t.id = r.erp_payment_ticket_id)
-> Seq Scan on tbl_erp_payment_tickets t (cost=0.00..61.24 rows=2054 width=48)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Hash (cost=85.89..85.89 rows=20 width=18)
-> Seq Scan on tbl_erp_payment_ticket_settles r (cost=0.00..85.89 rows=20 width=18)
Filter: (purchase_contract_id = ANY ('{4079,4077,4074,4040,4007,3976,3970,3968,3948,3933,3907,3898,3894,3990,3860,3859,3847,3843,3830,3826}'::integer[]))
-> Subquery Scan on "*SELECT* 2" (cost=12.79..50.31 rows=1 width=120)
-> Hash Join (cost=12.79..50.30 rows=1 width=124)
Hash Cond: (r_1.erp_other_income_ticket_id = t_1.id)
-> Seq Scan on tbl_erp_other_income_ticket_purchase_contract_settles r_1 (cost=0.00..37.30 rows=78 width=44)
Filter: (purchase_contract_id = ANY ('{4079,4077,4074,4040,4007,3976,3970,3968,3948,3933,3907,3898,3894,3990,3860,3859,3847,3843,3830,3826}'::integer[]))
-> Hash (cost=12.75..12.75 rows=3 width=48)
-> Seq Scan on tbl_erp_other_income_tickets t_1 (cost=0.00..12.75 rows=3 width=48)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Subquery Scan on "*SELECT* 3" (cost=12.65..50.17 rows=1 width=120)
-> Hash Join (cost=12.65..50.16 rows=1 width=124)
Hash Cond: (r_2.erp_cash_cost_ticket_id = t_2.id)
-> Seq Scan on tbl_erp_cash_cost_ticket_purchase_contract_settles r_2 (cost=0.00..37.30 rows=78 width=44)
Filter: (purchase_contract_id = ANY ('{4079,4077,4074,4040,4007,3976,3970,3968,3948,3933,3907,3898,3894,3990,3860,3859,3847,3843,3830,3826}'::integer[]))
-> Hash (cost=12.61..12.61 rows=3 width=48)
-> Seq Scan on tbl_erp_cash_cost_tickets t_2 (cost=0.00..12.61 rows=3 width=48)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Subquery Scan on "*SELECT* 4" (cost=82.76..150.17 rows=20 width=120)
-> Hash Join (cost=82.76..149.97 rows=20 width=124)
Hash Cond: (t_3.id = r_3.erp_collect_ticket_id)
-> Seq Scan on tbl_erp_collect_tickets t_3 (cost=0.00..59.31 rows=1986 width=48)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Hash (cost=82.51..82.51 rows=20 width=18)
-> Seq Scan on tbl_erp_collect_ticket_settles r_3 (cost=0.00..82.51 rows=20 width=18)
Filter: (purchase_contract_id = ANY ('{4079,4077,4074,4040,4007,3976,3970,3968,3948,3933,3907,3898,3894,3990,3860,3859,3847,3843,3830,3826}'::integer[]))