QUERY PLAN
Aggregate (cost=432.73..432.74 rows=1 width=8)
-> Hash Join (cost=419.69..432.73 rows=1 width=0)
Hash Cond: (tbl_pre_sales.case_id = c.id)
-> Seq Scan on tbl_pre_sales (cost=0.00..12.40 rows=240 width=4)
-> Hash (cost=419.68..419.68 rows=1 width=4)
-> HashAggregate (cost=419.66..419.67 rows=1 width=4)
Group Key: c.id
-> Nested Loop (cost=328.91..418.87 rows=315 width=4)
-> Seq Scan on tbl_engineer_group_relationships egr (cost=0.00..40.60 rows=1 width=4)
Filter: ((engineer_id = 5495) AND (engineer_group_id = 1))
-> Hash Right Join (cost=328.91..375.12 rows=315 width=8)
Hash Cond: (sgr.sales_id = c.deduct_points_from)
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..30.40 rows=2040 width=4)
-> Hash (cost=328.54..328.54 rows=30 width=12)
-> Hash Right Join (cost=273.81..328.54 rows=30 width=12)
Hash Cond: (cccr.case_id = c.id)
Filter: ((c.deduct_points_from = 5493) OR (c.deduct_points_from IS NULL) OR (c.last_engineer = 5495) OR (crr.user_id = 5495) OR (hashed SubPlan 1) OR (cccr.user_id = 5495) OR (c.created_by = 5495))
-> Seq Scan on tbl_case_carbon_copy_rels cccr (cost=0.00..30.40 rows=2040 width=8)
-> Hash (cost=238.20..238.20 rows=7 width=24)
-> Hash Right Join (cost=200.08..238.20 rows=7 width=24)
Hash Cond: (crr.remind_date_id = crd.id)
-> Seq Scan on tbl_case_remind_receivers crr (cost=0.00..30.40 rows=2040 width=8)
-> Hash (cost=200.00..200.00 rows=6 width=24)
-> Hash Right Join (cost=167.12..200.00 rows=6 width=24)
Hash Cond: (crd.case_id = c.id)
-> Seq Scan on tbl_case_remind_dates crd (cost=0.00..26.60 rows=1660 width=8)
-> Hash (cost=167.11..167.11 rows=1 width=20)
-> Hash Right Join (cost=127.62..167.11 rows=1 width=20)
Hash Cond: (tghr.task_group_id = tg.id)
Filter: ((tgur.user_id = 5495) OR (tghr.user_id = 5495))
-> Seq Scan on tbl_task_group_head_of_relationships tghr (cost=0.00..30.40 rows=2040 width=8)
-> Hash (cost=127.40..127.40 rows=17 width=28)
-> Hash Right Join (cost=89.18..127.40 rows=17 width=28)
Hash Cond: (tgur.task_group_id = tg.id)
-> Seq Scan on tbl_task_group_user_relationships tgur (cost=0.00..30.40 rows=2040 width=8)
-> Hash (cost=89.15..89.15 rows=3 width=24)
-> Hash Right Join (cost=69.22..89.15 rows=3 width=24)
Hash Cond: (cb.case_id = c.id)
-> Seq Scan on tbl_callback_records cb (cost=0.00..17.20 rows=720 width=4)
-> Hash (cost=69.20..69.20 rows=1 width=24)
-> Nested Loop Left Join (cost=39.05..69.20 rows=1 width=24)
-> Nested Loop Left Join (cost=38.90..60.99 rows=1 width=24)
-> Hash Right Join (cost=38.76..52.07 rows=1 width=24)
Hash Cond: (ps.case_id = c.id)
-> Seq Scan on tbl_pre_sales ps (cost=0.00..12.40 rows=240 width=4)
-> Hash (cost=38.75..38.75 rows=1 width=24)
-> Hash Right Join (cost=27.09..38.75 rows=1 width=24)
Hash Cond: (iri.implement_record_id = i.id)
-> Seq Scan on tbl_implement_items iri (cost=0.00..11.20 rows=120 width=4)
-> Hash (cost=27.08..27.08 rows=1 width=28)
-> Hash Right Join (cost=13.91..27.08 rows=1 width=28)
Hash Cond: (i.case_id = c.id)
-> Seq Scan on tbl_implement_records i (cost=0.00..12.50 rows=250 width=8)
-> Hash (cost=13.90..13.90 rows=1 width=28)
-> Seq Scan on tbl_cases c (cost=0.00..13.90 rows=1 width=28)
Filter: ((task_group_id IS NOT NULL) AND (last_engineer = 5495) AND (case_type = 1))
-> Index Only Scan using tbl_clients_pkey on tbl_clients client (cost=0.14..8.15 rows=1 width=4)
Index Cond: (id = c.client_id)
-> Index Only Scan using tbl_task_groups_pkey on tbl_task_groups tg (cost=0.15..8.17 rows=1 width=4)
Index Cond: (id = c.task_group_id)
SubPlan 1
-> Seq Scan on tbl_user_visit_clients (cost=0.00..35.50 rows=10 width=4)
Filter: (user_id = 5495)