nestloopon.sql
text/x-sql
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Nested Loop Left Join (cost=2488.35..2503.53 rows=1 width=74)
Filter: (("inner".account_id = "outer".account_id) OR ("inner".account_id IS NULL))
-> Nested Loop Left Join (cost=2488.35..2500.91 rows=1 width=74)
Join Filter: ("outer".service_order_detail_id = "inner".service_order_detail_id_new)
Filter: ("inner".service_order_detail_id_new IS NULL)
-> Hash Join (cost=2488.35..2489.40 rows=1 width=74)
Hash Cond: ("outer".service_semantic_type_id = "inner".service_semantic_type_id)
-> Seq Scan on semantic_type sst (cost=0.00..1.03 rows=3 width=16)
-> Hash (cost=2488.34..2488.34 rows=1 width=66)
-> Merge Join (cost=2430.84..2488.34 rows=1 width=66)
Merge Cond: ("outer".account_id = "inner".account_id)
Join Filter: (("outer".service_semantic_type_id = "inner".service_semantic_type_id) AND ("outer".subservice_id = "inner".service_id))
-> Nested Loop (cost=2290.94..27839.41 rows=485 width=78)
Join Filter: ("inner".service_id = "outer".service_id)
-> Nested Loop (cost=2290.94..6871.89 rows=15 width=74)
-> Nested Loop (cost=2290.94..6866.59 rows=5 width=58)
Join Filter: ("outer".service_order_detail_type_id = "inner".service_order_detail_type_id)
-> Merge Join (cost=2290.94..6856.21 rows=10 width=62)
Merge Cond: ("outer".account_id = "inner".parent_account_id)
Join Filter: ("inner".account_id = "outer".parent_account_id)
-> Nested Loop (cost=0.00..1223416.10 rows=190913 width=58)
-> Nested Loop (cost=0.00..718440.38 rows=95478 width=54)
-> Nested Loop (cost=0.00..335160.18 rows=95478 width=46)
-> Nested Loop (cost=0.00..3472.57 rows=65228 width=20)
-> Index Scan using account_pkey on account ap (cost=0.00..1004.01 rows=2 width=4)
Filter: (parent_account_id IS NULL)
-> Seq Scan on service_order bso (cost=0.00..908.14 rows=32614 width=16)
-> Index Scan using sod_service_order_id_idx on service_order_detail bsod (cost=0.00..5.06 rows=2 width=30)
Index Cond: ("outer".service_order_id = bsod.service_order_id)
-> Index Scan using service_pkey on service ss (cost=0.00..4.00 rows=1 width=8)
Index Cond: ("outer".service_id = ss.service_id)
-> Index Scan using breakdown_pkey on breakdown ab (cost=0.00..5.26 rows=2 width=8)
Index Cond: (ab.account_id = "outer".account_id)
-> Sort (cost=2290.94..2339.79 rows=19539 width=8)
Sort Key: aa.parent_account_id
-> Seq Scan on account aa (cost=0.00..898.39 rows=19539 width=8)
-> Seq Scan on service_order_detail_type (cost=0.00..1.02 rows=1 width=4)
Filter: ((service_order_detail_type_code)::text = 'create'::text)
-> Seq Scan on semantic_type tsst (cost=0.00..1.03 rows=3 width=16)
-> Seq Scan on breakdown tsb (cost=0.00..1061.26 rows=26926 width=12)
-> Sort (cost=139.90..142.14 rows=896 width=12)
Sort Key: tss.account_id
-> Seq Scan on service tss (cost=0.00..95.96 rows=896 width=12)
-> Seq Scan on service_order_service_change bsosc (cost=0.00..6.78 rows=378 width=4)
-> Index Scan using exposure_service_id_key on exposure tse (cost=0.00..2.60 rows=1 width=8)
Index Cond: ("outer".service_id = tse.service_id)
(46 rows)