QUERY PLAN
GroupAggregate (cost=10.68..10.71 rows=1 width=93)
Group Key: t.id, e.id, b.serial_no
-> Sort (cost=10.68..10.68 rows=1 width=93)
Sort Key: b.serial_no
-> Nested Loop Left Join (cost=0.14..10.67 rows=1 width=93)
Join Filter: (b.id = e.erp_bank_id)
-> Nested Loop Left Join (cost=0.14..9.42 rows=1 width=87)
-> Nested Loop Left Join (cost=0.00..4.39 rows=1 width=83)
Join Filter: (h.erp_other_income_ticket_id = t.id)
-> Nested Loop (cost=0.00..3.15 rows=1 width=79)
-> Seq Scan on tbl_erp_other_income_ticket_bank_ins e (cost=0.00..1.54 rows=1 width=26)
Filter: ((settle_at IS NOT NULL) AND (amount > '0'::numeric) AND (erp_other_income_ticket_id = 39) AND (id = 49))
-> Seq Scan on tbl_erp_other_income_tickets t (cost=0.00..1.60 rows=1 width=57)
Filter: ((verify_at IS NOT NULL) AND (id = 39) AND (status = 2))
-> Seq Scan on tbl_erp_other_income_ticket_handlers h (cost=0.00..1.18 rows=5 width=8)
Filter: (erp_other_income_ticket_id = 39)
-> Index Scan using tbl_users_pkey on tbl_users u (cost=0.14..4.96 rows=1 width=8)
Index Cond: (id = h.user_id)
-> Seq Scan on tbl_erp_banks b (cost=0.00..1.11 rows=11 width=10)