explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Psqd

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

Finalize Aggregate (cost=26,078.61..26,078.62 rows=1 width=8) (actual time=379.398..379.398 rows=1 loops=1)

2. 165.498 427.307 ↓ 1.5 3 1

Gather (cost=26,078.39..26,078.60 rows=2 width=8) (actual time=377.279..427.307 rows=3 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 36.174 261.809 ↑ 1.0 1 3 / 3

Partial Aggregate (cost=25,078.39..25,078.40 rows=1 width=8) (actual time=261.809..261.809 rows=1 loops=3)

4. 73.919 225.635 ↓ 3,133.5 347,819 3 / 3

Merge Left Join (cost=339.93..25,078.11 rows=111 width=0) (actual time=4.219..225.635 rows=347,819 loops=3)

  • Merge Cond: (contacts.id = contacts_tags_associations.contact_id)
  • Join Filter: (contacts_tags_associations.company_id = contacts.company_id)
  • Filter: ((contacts_tags.tag = 'import1502910941'::text) OR (contacts_tags_1.tag IS NULL))
  • Rows Removed by Filter: 41
5. 66.491 147.844 ↑ 1.3 347,859 3 / 3

Merge Left Join (cost=170.18..23,809.36 rows=435,266 width=47) (actual time=0.550..147.844 rows=347,859 loops=3)

  • Merge Cond: (contacts.id = contacts_tags_associations_1.contact_id)
  • Join Filter: (contacts_tags_associations_1.company_id = contacts.company_id)
6. 80.920 80.920 ↑ 1.3 347,859 3 / 3

Parallel Index Only Scan using ix_company_id_id on contacts (cost=0.43..22,541.51 rows=435,266 width=26) (actual time=0.116..80.920 rows=347,859 loops=3)

  • Index Cond: (company_id = '\x4c2118ad54397f271b000000'::bytea)
  • Heap Fetches: 3,287
7. 0.126 0.433 ↑ 8.8 123 3 / 3

Sort (cost=169.75..172.46 rows=1,084 width=47) (actual time=0.426..0.433 rows=123 loops=3)

  • Sort Key: contacts_tags_associations_1.contact_id
  • Sort Method: quicksort Memory: 34kB
8. 0.055 0.307 ↑ 8.8 123 3 / 3

Nested Loop (cost=0.84..115.11 rows=1,084 width=47) (actual time=0.258..0.307 rows=123 loops=3)

9. 0.107 0.107 ↑ 1.0 1 3 / 3

Index Only Scan using ix_contacts_tags_company_id_tag_tag_id on contacts_tags contacts_tags_1 (cost=0.28..2.50 rows=1 width=47) (actual time=0.106..0.107 rows=1 loops=3)

  • Index Cond: ((company_id = '\x4c2118ad54397f271b000000'::bytea) AND (tag = '00_bulk_131'::text))
  • Heap Fetches: 1
10. 0.145 0.145 ↑ 22.3 123 3 / 3

Index Only Scan using ix_contacts_tags_associations_company_id_tag_id_contact_id on contacts_tags_associations contacts_tags_associations_1 (cost=0.56..85.16 rows=2,745 width=39) (actual time=0.114..0.145 rows=123 loops=3)

  • Index Cond: ((company_id = '\x4c2118ad54397f271b000000'::bytea) AND (tag_id = contacts_tags_1.id))
  • Heap Fetches: 0
11. 2.238 3.872 ↓ 3.6 3,933 3 / 3

Sort (cost=169.75..172.46 rows=1,084 width=47) (actual time=3.621..3.872 rows=3,933 loops=3)

  • Sort Key: contacts_tags_associations.contact_id
  • Sort Method: quicksort Memory: 404kB
12. 0.411 1.634 ↓ 3.6 3,933 3 / 3

Nested Loop (cost=0.84..115.11 rows=1,084 width=47) (actual time=0.072..1.634 rows=3,933 loops=3)

13. 0.036 0.036 ↑ 1.0 1 3 / 3

Index Only Scan using ix_contacts_tags_company_id_tag_tag_id on contacts_tags (cost=0.28..2.50 rows=1 width=47) (actual time=0.035..0.036 rows=1 loops=3)

  • Index Cond: ((company_id = '\x4c2118ad54397f271b000000'::bytea) AND (tag = 'import1502910941'::text))
  • Heap Fetches: 1
14. 1.187 1.187 ↓ 1.4 3,933 3 / 3

Index Only Scan using ix_contacts_tags_associations_company_id_tag_id_contact_id on contacts_tags_associations (cost=0.56..85.16 rows=2,745 width=39) (actual time=0.035..1.187 rows=3,933 loops=3)

  • Index Cond: ((company_id = '\x4c2118ad54397f271b000000'::bytea) AND (tag_id = contacts_tags.id))
  • Heap Fetches: 0
Planning time : 0.759 ms
Execution time : 427.745 ms