explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1oRm

Settings
# exclusive inclusive rows x rows loops node
1. 3.945 118.100 ↑ 1.0 1 1

Aggregate (cost=3,212.62..3,212.63 rows=1 width=8) (actual time=118.099..118.100 rows=1 loops=1)

2. 3.744 114.155 ↓ 25.1 68,500 1

Result (cost=71.91..3,205.79 rows=2,732 width=0) (actual time=16.967..114.155 rows=68,500 loops=1)

  • One-Time Filter: ((current_setting('nimble.company_id'::text))::bytea = '\x4d670aba143e3287b9d4427a'::bytea)
3. 94.274 110.411 ↓ 25.1 68,500 1

Bitmap Heap Scan on contacts (cost=71.91..3,205.79 rows=2,732 width=0) (actual time=16.963..110.411 rows=68,500 loops=1)

  • Recheck Cond: (((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (owner_id = (current_setting('nimble.user_id'::text))::bytea)) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (read_for_users && '{""\\x00""}'::bytea[])) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (read_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea])) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (read_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[])) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (edit_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea])) OR ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (edit_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[])))
  • Filter: ((owner_id = (current_setting('nimble.user_id'::text))::bytea) OR (read_for_users && '{""\\x00""}'::bytea[]) OR (read_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea]) OR (read_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[]) OR (edit_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea]) OR (edit_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[]))
  • Heap Blocks: exact=5,783
4. 0.001 16.137 ↓ 0.0 0 1

BitmapOr (cost=71.90..71.90 rows=2,760 width=0) (actual time=16.137..16.137 rows=0 loops=1)

5. 0.032 0.032 ↓ 0.0 0 1

Bitmap Index Scan on ix_company_id_owner_id (cost=0.00..1.79 rows=13 width=0) (actual time=0.032..0.032 rows=0 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (owner_id = (current_setting('nimble.user_id'::text))::bytea))
6. 15.995 15.995 ↓ 124.8 68,500 1

Bitmap Index Scan on ix_company_rls_permissions (cost=0.00..13.19 rows=549 width=0) (actual time=15.995..15.995 rows=68,500 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (read_for_users && '{""\\x00""}'::bytea[]))
7. 0.042 0.042 ↓ 0.0 0 1

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

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (read_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea]))
8. 0.029 0.029 ↓ 0.0 0 1

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

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (read_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[]))
9. 0.019 0.019 ↓ 0.0 0 1

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

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (edit_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea]))
10. 0.019 0.019 ↓ 0.0 0 1

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

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (edit_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[]))
Planning time : 0.643 ms
Execution time : 118.768 ms