explain.depesz.com

PostgreSQL's explain analyze made readable

Result: R6OJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 480.543 ↑ 1.0 1 1

Aggregate (cost=64,484.13..64,484.14 rows=1 width=8) (actual time=480.543..480.543 rows=1 loops=1)

2. 0.000 476.974 ↑ 2.1 50,000 1

Index Scan using contacts_pkey on contacts (cost=0.44..64,218.68 rows=106,182 width=0) (actual time=0.029..476.974 rows=50,000 loops=1)

  • Index Cond: (company_id = (current_setting('nimble.company_id'::text))::bytea)
  • Filter: (((owner_id IS NOT NULL) AND (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[]))
3. 480.543 480.543 ↑ 1.0 1 1

Rows Removed by Filter: 66382Aggregate (cost=64,484.13..64,484.14 rows=1 width=8) (actual time=480.543..480.543 rows=1 loops=1)

4. 476.974 476.974 ↑ 2.1 50,000 1

Index Scan using contacts_pkey on contacts (cost=0.44..64,218.68 rows=106,182 width=0) (actual time=0.029..476.974 rows=50,000 loops=1)

  • Index Cond: (company_id = (current_setting('nimble.company_id'::text))::bytea)
  • Filter: (((owner_id IS NOT NULL) AND (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[]))
  • Rows Removed by Filter: 66,382
Planning time : 3.599 ms
Execution time : 480.639 ms