QUERY PLAN
Sort (cost=737.69..737.99 rows=119 width=141)
Sort Key: "*SELECT* 1".id DESC
-> Result (cost=86.56..733.59 rows=119 width=141)
-> Append (cost=86.56..732.40 rows=119 width=109)
-> Subquery Scan on "*SELECT* 1" (cost=86.56..156.31 rows=20 width=63)
-> Hash Join (cost=86.56..156.12 rows=20 width=67)
Hash Cond: (t.id = r.erp_payment_ticket_id)
-> Seq Scan on tbl_erp_payment_tickets t (cost=0.00..61.41 rows=2066 width=17)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Hash (cost=86.31..86.31 rows=20 width=18)
-> Seq Scan on tbl_erp_payment_ticket_settles r (cost=0.00..86.31 rows=20 width=18)
Filter: (purchase_contract_id = ANY ('{4081,4080,4079,4077,4074,4072,4070,4069,4067,4066,4063,4062,4060,4059,4058,4057,4053,4052,4051,4045}'::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 ('{4081,4080,4079,4077,4074,4072,4070,4069,4067,4066,4063,4062,4060,4059,4058,4057,4053,4052,4051,4045}'::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=38.28..375.45 rows=78 width=118)
-> Hash Join (cost=38.28..374.67 rows=78 width=122)
Hash Cond: (t_2.id = r_2.erp_cash_cost_ticket_id)
-> Seq Scan on tbl_erp_cash_cost_tickets t_2 (cost=0.00..243.49 rows=7308 width=46)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Hash (cost=37.30..37.30 rows=78 width=44)
-> 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 ('{4081,4080,4079,4077,4074,4072,4070,4069,4067,4066,4063,4062,4060,4059,4058,4057,4053,4052,4051,4045}'::integer[]))
-> Subquery Scan on "*SELECT* 4" (cost=82.87..150.32 rows=20 width=120)
-> Hash Join (cost=82.87..150.12 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.35 rows=1989 width=48)
Filter: (status = ANY ('{2,5,1}'::integer[]))
-> Hash (cost=82.62..82.62 rows=20 width=18)
-> Seq Scan on tbl_erp_collect_ticket_settles r_3 (cost=0.00..82.62 rows=20 width=18)
Filter: (purchase_contract_id = ANY ('{4081,4080,4079,4077,4074,4072,4070,4069,4067,4066,4063,4062,4060,4059,4058,4057,4053,4052,4051,4045}'::integer[]))