QUERY PLAN
Sort (cost=401.93..402.23 rows=120 width=128)
Sort Key: "*SELECT* 1".id DESC
-> Result (cost=86.15..397.78 rows=120 width=128)
-> Append (cost=86.15..396.58 rows=120 width=97)
-> Subquery Scan on "*SELECT* 1" (cost=86.15..155.73 rows=21 width=94)
-> Hash Join (cost=86.15..155.52 rows=21 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=21 width=18)
-> Seq Scan on tbl_erp_payment_ticket_settles r (cost=0.00..85.89 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=1.31..40.38 rows=78 width=91)
-> Hash Join (cost=1.31..39.60 rows=78 width=95)
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 ('{4056,4000,3987,3982,3969,3936,3917,3903,3902,3901,3863,3804,3769,3756,3773,3747,3727,3726,3704,3663}'::integer[]))
-> Hash (cost=1.17..1.17 rows=12 width=19)
-> Seq Scan on tbl_erp_cash_cost_tickets t_2 (cost=0.00..1.17 rows=12 width=19)
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 ('{4056,4000,3987,3982,3969,3936,3917,3903,3902,3901,3863,3804,3769,3756,3773,3747,3727,3726,3704,3663}'::integer[]))