explain.depesz.com

PostgreSQL's explain analyze made readable

Result: g4rI2

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 446.299 ↑ 1.0 1 1

Aggregate (cost=83,428.32..83,428.33 rows=1 width=8) (actual time=446.299..446.299 rows=1 loops=1)

2. 432.147 446.297 ↓ 0.0 0 1

Bitmap Heap Scan on contacts (cost=1,192.22..83,243.88 rows=73,779 width=0) (actual time=446.297..446.297 rows=0 loops=1)

  • Recheck Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (owner_id IS NOT NULL) AND (owner_id = '\x5398dc0e8d88180bc11c4013'::bytea)) OR (read_for_users && '{}'::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[]))
  • Filter: (((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (current_setting('nimble.view_all_contacts'::text))::boolean) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (owner_id IS NOT NULL) AND (owner_id = '\x5398dc0e8d88180bc11c4013'::bytea)) OR (read_for_users && '{}'::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: 116,382
  • Heap Blocks: exact=10,355
3. 0.000 14.150 ↓ 0.0 0 1

BitmapOr (cost=1,192.22..1,192.22 rows=132,546 width=0) (actual time=14.150..14.150 rows=0 loops=1)

4. 14.076 14.076 ↓ 1.0 116,382 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..917.54 rows=115,739 width=0) (actual time=14.076..14.076 rows=116,382 loops=1)

  • Index Cond: (company_id = '\x4d670aba143e3287b9d4427a'::bytea)
5. 0.031 0.031 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_id_owner_id (cost=0.00..2.28 rows=50 width=0) (actual time=0.031..0.031 rows=0 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (owner_id IS NOT NULL) AND (owner_id = '\x5398dc0e8d88180bc11c4013'::bytea))
6. 0.005 0.005 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..0.00 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=1)

  • Index Cond: (read_for_users && '{}'::bytea[])
7. 0.012 0.012 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..35.82 rows=4,189 width=0) (actual time=0.011..0.012 rows=0 loops=1)

  • Index Cond: (read_for_users && '{""\\x5398dc0e8d88180bc11c4013""}'::bytea[])
8. 0.016 0.016 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..35.82 rows=4,189 width=0) (actual time=0.016..0.016 rows=0 loops=1)

  • Index Cond: (read_for_groups && ('{""\\x5eea2d89f92ea11022dac13a""}'::text[])::bytea[])
9. 0.005 0.005 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..35.82 rows=4,189 width=0) (actual time=0.004..0.005 rows=0 loops=1)

  • Index Cond: (edit_for_users && '{""\\x5398dc0e8d88180bc11c4013""}'::bytea[])
10. 0.006 0.006 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..35.82 rows=4,189 width=0) (actual time=0.006..0.006 rows=0 loops=1)

  • Index Cond: (edit_for_groups && ('{""\\x5eea2d89f92ea11022dac13a""}'::text[])::bytea[])
Planning time : 0.457 ms
Execution time : 446.707 ms