explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1TOo

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 0.338 ↑ 1.0 1 1

Aggregate (cost=3,929.95..3,929.96 rows=1 width=8) (actual time=0.338..0.338 rows=1 loops=1)

2. 0.001 0.335 ↓ 0.0 0 1

Bitmap Heap Scan on contacts (cost=67.59..3,921.58 rows=3,347 width=0) (actual time=0.335..0.335 rows=0 loops=1)

  • Recheck Cond: (((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (owner_id = (current_setting('nimble.user_id'::text))::bytea)) OR ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (read_for_users && '{""\\x5c783030""}'::bytea[])) OR ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (read_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea])) OR ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (read_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[])) OR ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (edit_for_users && ARRAY[(current_setting('nimble.user_id'::text))::bytea])) OR ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (edit_for_groups && (string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[])))
  • Filter: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND ((owner_id = (current_setting('nimble.user_id'::text))::bytea) OR (read_for_users && '{""\\x5c783030""}'::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[])))
3. 0.001 0.334 ↓ 0.0 0 1

BitmapOr (cost=67.59..67.59 rows=3,388 width=0) (actual time=0.334..0.334 rows=0 loops=1)

4. 0.156 0.156 ↓ 0.0 0 1

Bitmap Index Scan on ix_rls_permissions (cost=0.00..11.42 rows=481 width=0) (actual time=0.156..0.156 rows=0 loops=1)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (owner_id = (current_setting('nimble.user_id'::text))::bytea))
5. 0.030 0.030 ↓ 0.0 0 1

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

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (read_for_users && '{""\\x5c783030""}'::bytea[]))
6. 0.025 0.025 ↓ 0.0 0 1

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

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

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

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

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

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

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

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