explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4D9X

Settings
# exclusive inclusive rows x rows loops node
1. 790.367 803.919 ↑ 5.5 2 1

Seq Scan on public.employee (cost=0.00..86,311.01 rows=11 width=144) (actual time=2.819..803.919 rows=2 loops=1)

  • Output: employee.id, employee.user_id, employee.active, employee.created_at, employee.updated_at, employee.is_archived, employee.company_id, employee.departments, employee.employment_end, employee.is_leader, employee.leader_departments, employee.group_ids
  • Filter: (((employee.is_leader AND (NOT employee.is_archived) AND ((employee.employment_end > now()) OR (employee.employment_end IS NULL)) AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, employee.leader_departments, employee.company_id)) OR ((NOT employee.is_archived) AND (NOT employee.is_leader) AND ((employee.employment_end > now()) OR (employee.employment_end IS NULL)) AND policy_role_check('employee'::text, 'general'::text, 'read'::text, employee.user_id, employee.departments, employee.company_id)) OR (employee.is_leader AND (employee.is_archived OR (employee.employment_end <= now())) AND policy_role_check('employee'::text, 'leader'::text, 'read'::text, employee.leader_departments, employee.company_id) AND policy_role_check('employee'::text, 'archived'::text, 'read'::text, employee.leader_departments, employee.company_id)) OR ((NOT employee.is_leader) AND (employee.is_archived OR (employee.employment_end <= now())) AND policy_role_check('employee'::text, 'archived'::text, 'read'::text, employee.user_id, employee.departments, employee.company_id)) OR (employee.user_id = current_user_id())) AND ((SubPlan 1) = '1'::bigint))
  • Rows Removed by Filter: 7089
2.          

SubPlan (for Seq Scan)

3. 0.176 13.552 ↑ 1.0 1 176

Aggregate (cost=10.57..10.58 rows=1 width=8) (actual time=0.077..0.077 rows=1 loops=176)

  • Output: count(*)
4. 0.348 13.376 ↓ 0.0 0 176

Nested Loop (cost=0.28..10.32 rows=100 width=0) (actual time=0.076..0.076 rows=0 loops=176)

5. 13.024 13.024 ↓ 0.0 0 176

Index Scan using user_keywords_pkey on public.user_keywords (cost=0.28..8.31 rows=1 width=0) (actual time=0.074..0.074 rows=0 loops=176)

  • Output: user_keywords.user_id, user_keywords.company_id, user_keywords.keywords
  • Index Cond: (user_keywords.user_id = employee.user_id)
  • Filter: ('anne1'::text % ANY (user_keywords.keywords))
  • Rows Removed by Filter: 1
6. 0.004 0.004 ↑ 100.0 1 2

Function Scan on pg_catalog.unnest (cost=0.00..1.00 rows=100 width=0) (actual time=0.002..0.002 rows=1 loops=2)

  • Output: unnest.unnest
  • Function Call: unnest('{anne1}'::text[])