explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DHT0

Settings
# exclusive inclusive rows x rows loops node
1. 624.971 55,786.921 ↓ 1.9 4,713,629 1

Result (cost=0.56..114,521,765.60 rows=2,434,440 width=26) (actual time=0.746..55,786.921 rows=4,713,629 loops=1)

  • One-Time Filter: ((current_setting('nimble.company_id'::text))::bytea = '\x4c2118ad54397f271b000000'::bytea)
2. 8,025.660 55,161.950 ↓ 1.9 4,713,629 1

Index Only Scan using contacts_tags_associations_pkey on contacts_tags_associations (cost=0.56..114,521,765.60 rows=2,434,440 width=26) (actual time=0.614..55,161.950 rows=4,713,629 loops=1)

  • Index Cond: (company_id = '\x4c2118ad54397f271b000000'::bytea)
  • Filter: (((SubPlan 1) IS NULL) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && (SubPlan 2)) OR (alternatives: SubPlan 3 or hashed SubPlan 4) OR ((SubPlan 5) IS NULL) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && (SubPlan 6)) OR ((SubPlan 7) IS NULL) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && (SubPlan 8)) OR ((SubPlan 9) IS NULL) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && (SubPlan 10)))
  • Heap Fetches: 4,713,629
3.          

SubPlan (for Index Only Scan)

4. 47,136.290 47,136.290 ↓ 0.0 0 4,713,629

Index Scan using contacts_pkey on contacts (cost=0.44..2.71 rows=1 width=37) (actual time=0.010..0.010 rows=0 loops=4,713,629)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
  • Rows Removed by Filter: 1
5. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_1 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
6. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_2 (cost=0.44..2.71 rows=1 width=0) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: ((owner_id = (current_setting('nimble.user_id'::text))::bytea) AND (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups)))
7. 0.000 0.000 ↓ 0.0 0

Index Scan using ix_company_id_owner_id on contacts contacts_3 (cost=0.44..17.04 rows=1 width=13) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (owner_id = (current_setting('nimble.user_id'::text))::bytea))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
8. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_4 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
9. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_5 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
10. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_6 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
11. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_7 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
12. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_8 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
13. 0.000 0.000 ↓ 0.0 0

Index Scan using contacts_pkey on contacts contacts_9 (cost=0.44..2.71 rows=1 width=37) (never executed)

  • Index Cond: ((company_id = (current_setting('nimble.company_id'::text))::bytea) AND (contacts_tags_associations.contact_id = id))
  • Filter: (((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && read_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && read_for_groups) OR ((string_to_array(current_setting('nimble.user_id'::text), ','::text))::bytea[] && edit_for_users) OR ((string_to_array(current_setting('nimble.group_ids'::text), ','::text))::bytea[] && edit_for_groups))
Planning time : 4.853 ms
Execution time : 56,014.225 ms