QUERY PLAN
Sort (cost=737.79..738.09 rows=120 width=140)
Sort Key: "*SELECT* 1".id DESC
-> Result (cost=86.57..733.64 rows=120 width=140)
-> Append (cost=86.57..732.44 rows=120 width=109)
-> Subquery Scan on "*SELECT* 1" (cost=86.57..156.36 rows=21 width=63)
-> Hash Join (cost=86.57..156.15 rows=21 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=21 width=18)
-> Seq Scan on tbl_erp_payment_ticket_settles r (cost=0.00..86.31 rows=21 width=18)
Filter: (purchase_contract_id = ANY ('{4056,4000,3987,3982,3969,3936,3917,3903,3902,3901,3863,3804,3769,3756,3773,3747,3727,3726,3704,3663}'::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 ('{4056,4000,3987,3982,3969,3936,3917,3903,3902,3901,3863,3804,3769,3756,3773,3747,3727,3726,3704,3663}'::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 ('{4056,4000,3987,3982,3969,3936,3917,3903,3902,3901,3863,3804,3769,3756,3773,3747,3727,3726,3704,3663}'::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 ('{4056,4000,3987,3982,3969,3936,3917,3903,3902,3901,3863,3804,3769,3756,3773,3747,3727,3726,3704,3663}'::integer[]))