QUERY PLAN
Result (cost=87.48..87.49 rows=1 width=1)
InitPlan 2 (returns $2)
-> Nested Loop Left Join (cost=35.80..87.48 rows=1 width=0)
Filter: ((c.sales_rep IS NULL) OR (c.sales_rep = 5493) OR (prr.user_id = 5493) OR (hashed SubPlan 1))
-> Nested Loop Left Join (cost=0.14..43.78 rows=1 width=8)
Join Filter: (prr.project_id = p.id)
-> Index Scan using tbl_projects_pkey on tbl_projects p (cost=0.14..8.16 rows=1 width=8)
Index Cond: (id = 1)
-> Seq Scan on tbl_project_remind_receivers prr (cost=0.00..35.50 rows=10 width=8)
Filter: (project_id = 1)
-> Index Scan using tbl_clients_pkey on tbl_clients c (cost=0.14..8.15 rows=1 width=8)
Index Cond: (p.client_id = id)
SubPlan 1
-> Seq Scan on tbl_user_visit_clients (cost=0.00..35.50 rows=10 width=4)
Filter: (user_id = 5493)