explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zvfv

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 23,034.973 ↑ 1.0 1 1

Limit (cost=10,797.51..10,797.51 rows=1 width=29) (actual time=23,034.973..23,034.973 rows=1 loops=1)

  • Output: contacts.id, contacts__aggregated_1.value
2. 0.008 23,034.972 ↑ 1.0 1 1

Sort (cost=10,797.51..10,797.51 rows=1 width=29) (actual time=23,034.972..23,034.972 rows=1 loops=1)

  • Output: contacts.id, contacts__aggregated_1.value
  • Sort Key: contacts__aggregated_1.value
  • Sort Method: quicksort Memory: 25kB
3. 0.006 23,034.964 ↑ 1.0 1 1

Result (cost=472.45..10,797.50 rows=1 width=29) (actual time=23,034.961..23,034.964 rows=1 loops=1)

  • Output: contacts.id, contacts__aggregated_1.value
  • One-Time Filter: ((current_setting('nimble.company_id'::text))::bytea = '\x5793b812034b24175383458d'::bytea)
4. 7.624 23,034.958 ↑ 1.0 1 1

Nested Loop Semi Join (cost=472.45..10,797.50 rows=1 width=29) (actual time=23,034.955..23,034.958 rows=1 loops=1)

  • Output: contacts.id, contacts__aggregated_1.value
5. 11.800 41.742 ↓ 15,918.0 15,918 1

Hash Join (cost=470.80..901.03 rows=1 width=42) (actual time=17.175..41.742 rows=15,918 loops=1)

  • Output: contacts.id, contacts__aggregated_1.value, contacts__aggregated_1.contact_id
  • Inner Unique: true
  • Hash Cond: (contacts.id = contacts__aggregated_1.contact_id)
6. 12.834 12.834 ↓ 2.6 15,918 1

Index Only Scan using ix_company_id_contact_type on public.contacts (cost=0.56..414.46 rows=6,223 width=26) (actual time=0.029..12.834 rows=15,918 loops=1)

  • Output: contacts.company_id, contacts.contact_type, contacts.id
  • Index Cond: ((contacts.company_id = '\x5793b812034b24175383458d'::bytea) AND (contacts.contact_type = 'person'::text))
  • Heap Fetches: 6726
7. 5.690 17.108 ↓ 2.5 17,619 1

Hash (cost=380.95..380.95 rows=7,143 width=42) (actual time=17.108..17.108 rows=17,619 loops=1)

  • Output: contacts__aggregated_1.value, contacts__aggregated_1.company_id, contacts__aggregated_1.contact_id
  • Buckets: 32768 (originally 8192) Batches: 1 (originally 1) Memory Usage: 1506kB
8. 11.418 11.418 ↓ 2.5 17,619 1

Index Only Scan using ix_company_id_field_name_value_contact_id on public.contacts__aggregated contacts__aggregated_1 (cost=0.56..380.95 rows=7,143 width=42) (actual time=0.027..11.418 rows=17,619 loops=1)

  • Output: contacts__aggregated_1.value, contacts__aggregated_1.company_id, contacts__aggregated_1.contact_id
  • Index Cond: ((contacts__aggregated_1.company_id = '\x5793b812034b24175383458d'::bytea) AND (contacts__aggregated_1.field_name = 'names'::text))
  • Heap Fetches: 5333
9. 22.863 22,985.592 ↓ 0.0 0 15,918

Nested Loop (cost=1.65..9,896.45 rows=1 width=13) (actual time=1.444..1.444 rows=0 loops=15,918)

  • Output: contacts_values_1.id
  • Join Filter: (encode(contacts_values_2.id, 'hex'::text) = nimble_contact_value_normalize(CASE WHEN (length(contacts_values_1.value) < 1024) THEN contacts_values_1.value ELSE NULL::text END))
  • Rows Removed by Join Filter: 0
10. 95.508 95.508 ↓ 0.0 0 15,918

Index Scan using contacts_values_pkey on public.contacts_values contacts_values_1 (cost=0.70..4.72 rows=1 width=50) (actual time=0.006..0.006 rows=0 loops=15,918)

  • Output: contacts_values_1.company_id, contacts_values_1.value, contacts_values_1.id
  • Index Cond: ((contacts_values_1.company_id = '\x5793b812034b24175383458d'::bytea) AND (contacts_values_1.id = contacts__aggregated_1.contact_id) AND (contacts_values_1.field_id = '\x000000000000000000000000'::bytea) AND (contacts_values_1.field_name = 'parent_company'::text))
11. 22,867.221 22,867.221 ↑ 1.0 1 1,961

Index Scan using ix_contacts_values_company_id_field_value_norm on public.contacts_values contacts_values_2 (cost=0.95..9,891.46 rows=1 width=26) (actual time=5.801..11.661 rows=1 loops=1,961)

  • Output: contacts_values_2.company_id, contacts_values_2.id
  • Index Cond: ((contacts_values_2.company_id = '\x5793b812034b24175383458d'::bytea) AND (contacts_values_2.field_id = '\x000000000000000000000000'::bytea) AND (contacts_values_2.field_name = 'company_name'::text))
  • Filter: (nimble_contact_value_normalize(CASE WHEN (length(contacts_values_2.value) < 1024) THEN contacts_values_2.value ELSE NULL::text END) = 'law office of trujillo and sanchez, p.c'::text)
  • Rows Removed by Filter: 1700
Planning time : 1.834 ms
Execution time : 23,036.131 ms