explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gr4p

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 3,669.407 ↑ 1.0 1 1

Aggregate (cost=133,237.10..133,237.11 rows=1 width=8) (actual time=3,669.407..3,669.407 rows=1 loops=1)

2.          

CTE can_view

3. 0.013 0.013 ↑ 1.0 1 1

Function Scan on can_view_all_contacts (cost=0.01..0.02 rows=1 width=1) (actual time=0.012..0.013 rows=1 loops=1)

4.          

Initplan (for Aggregate)

5. 0.015 0.015 ↑ 1.0 1 1

CTE Scan on can_view (cost=0.00..0.02 rows=1 width=1) (actual time=0.014..0.015 rows=1 loops=1)

6. 3,564.566 3,669.403 ↓ 0.0 0 1

Bitmap Heap Scan on contacts (cost=8,747.20..131,932.63 rows=521,774 width=0) (actual time=3,669.403..3,669.403 rows=0 loops=1)

  • Recheck Cond: (company_id = '\x4c2118ad54397f271b000000'::bytea)
  • Filter: ($1 OR ((owner_id IS NOT NULL) AND (owner_id = '\x5b18e9a029e8e93b731d6bad'::bytea)) OR (read_for_users && '{""\\x5398dc0e8d88180bc11c4013""}'::bytea[]) OR (read_for_groups && ('{""\\x5eea2d89f92ea11022dac13a""}'::text[])::bytea[]) OR (edit_for_users && '{""\\x5398dc0e8d88180bc11c4013""}'::bytea[]) OR (edit_for_groups && ('{""\\x5eea2d89f92ea11022dac13a""}'::text[])::bytea[]))
  • Rows Removed by Filter: 1,052,168
  • Heap Blocks: exact=49,782
7. 104.837 104.837 ↓ 1.0 1,052,168 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..8,616.76 rows=1,034,355 width=0) (actual time=104.837..104.837 rows=1,052,168 loops=1)

  • Index Cond: (company_id = '\x4c2118ad54397f271b000000'::bytea)
Planning time : 0.252 ms
Execution time : 3,670.128 ms