explain.depesz.com

PostgreSQL's explain analyze made readable

Result: igWt

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.245 ↓ 3.0 3 1

Result (cost=25.29..31.32 rows=1 width=515) (actual time=0.221..0.245 rows=3 loops=1)

  • One-Time Filter: ((current_setting('nimble.company_id'::text))::bytea = '\x4d670aba143e3287b9d4427a'::bytea)
2.          

Initplan (for Result)

3. 0.009 0.009 ↑ 1.0 1 1

Function Scan on can_view_all_contacts (cost=0.01..0.02 rows=1 width=1) (actual time=0.009..0.009 rows=1 loops=1)

4. 0.000 0.241 ↓ 3.0 3 1

Nested Loop Left Join (cost=25.29..31.32 rows=1 width=515) (actual time=0.217..0.241 rows=3 loops=1)

  • Join Filter: (contacts.id = contacts__timestamps.contact_id)
5. 0.003 0.214 ↓ 3.0 3 1

Nested Loop Left Join (cost=19.58..25.55 rows=1 width=374) (actual time=0.191..0.214 rows=3 loops=1)

  • Join Filter: (contacts.id = contacts_values.contact_id)
  • Rows Removed by Join Filter: 3
6. 0.005 0.112 ↓ 3.0 3 1

Nested Loop Left Join (cost=6.53..11.94 rows=1 width=233) (actual time=0.095..0.112 rows=3 loops=1)

  • Join Filter: (contacts.id = contacts__addresses.contact_id)
  • Rows Removed by Join Filter: 3
7. 0.044 0.044 ↓ 3.0 3 1

Index Scan using contacts_pkey on contacts (cost=0.43..5.78 rows=1 width=92) (actual time=0.035..0.044 rows=3 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (id = ANY ('{""\\x56b1303eb2a6bd497256f7f2"",""\\x56b1303fb2a6bd497256f7ff"",""\\x56b1303fb2a6bd497256f808""}'::bytea[])))
  • Filter: ($0 OR (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[]))
8. 0.012 0.063 ↓ 2.0 2 3

GroupAggregate (cost=6.10..6.14 rows=1 width=141) (actual time=0.020..0.021 rows=2 loops=3)

  • Group Key: contacts__addresses.contact_id
9. 0.027 0.051 ↓ 2.0 2 3

Sort (cost=6.10..6.11 rows=1 width=90) (actual time=0.016..0.017 rows=2 loops=3)

  • Sort Key: contacts__addresses.contact_id
  • Sort Method: quicksort Memory: 25kB
10. 0.024 0.024 ↓ 2.0 2 1

Index Scan using contacts__addresses_pkey on contacts__addresses (cost=0.55..6.09 rows=1 width=90) (actual time=0.020..0.024 rows=2 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (contact_id = ANY ('{""\\x56b1303eb2a6bd497256f7f2"",""\\x56b1303fb2a6bd497256f7ff"",""\\x56b1303fb2a6bd497256f808""}'::bytea[])))
11. 0.040 0.099 ↑ 6.5 2 3

HashAggregate (cost=13.06..13.32 rows=13 width=141) (actual time=0.031..0.033 rows=2 loops=3)

  • Group Key: contacts_values.contact_id
12. 0.059 0.059 ↓ 3.8 49 1

Index Scan using contacts_values_pkey on contacts_values (cost=0.56..12.89 rows=13 width=60) (actual time=0.017..0.059 rows=49 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (contact_id = ANY ('{""\\x56b1303eb2a6bd497256f7f2"",""\\x56b1303fb2a6bd497256f7ff"",""\\x56b1303fb2a6bd497256f808""}'::bytea[])))
13. 0.003 0.027 ↓ 0.0 0 3

GroupAggregate (cost=5.68..5.72 rows=1 width=141) (actual time=0.009..0.009 rows=0 loops=3)

  • Group Key: contacts__timestamps.contact_id
14. 0.007 0.024 ↓ 0.0 0 3

Sort (cost=5.68..5.68 rows=1 width=45) (actual time=0.008..0.008 rows=0 loops=3)

  • Sort Key: contacts__timestamps.contact_id
  • Sort Method: quicksort Memory: 25kB
15. 0.017 0.017 ↓ 0.0 0 1

Index Scan using contacts__timestamps_pkey on contacts__timestamps (cost=0.41..5.67 rows=1 width=45) (actual time=0.017..0.017 rows=0 loops=1)

  • Index Cond: ((company_id = '\x4d670aba143e3287b9d4427a'::bytea) AND (contact_id = ANY ('{""\\x56b1303eb2a6bd497256f7f2"",""\\x56b1303fb2a6bd497256f7ff"",""\\x56b1303fb2a6bd497256f808""}'::bytea[])))
Planning time : 1.996 ms
Execution time : 0.503 ms