explain.depesz.com

PostgreSQL's explain analyze made readable

Result: V51f

Settings
# exclusive inclusive rows x rows loops node
1. 1.065 11,666.718 ↑ 1.0 1 1

Aggregate (cost=1,069,775.19..1,069,775.2 rows=1 width=8) (actual time=11,666.718..11,666.718 rows=1 loops=1)

  • Buffers: shared hit=780812, temp read=8991 written=8991
2. 5.098 11,665.653 ↑ 13.5 14,566 1

Nested Loop (cost=1,068,149.44..1,069,285.01 rows=196,070 width=0) (actual time=11,627.679..11,665.653 rows=14,566 loops=1)

  • Buffers: shared hit=780812, temp read=8991 written=8991
3. 12.398 11,631.423 ↓ 72.8 14,566 1

HashAggregate (cost=1,068,149.01..1,068,151.01 rows=200 width=8) (actual time=11,627.593..11,631.423 rows=14,566 loops=1)

  • Group Key: sequence_leads_1.id
  • Buffers: shared hit=731394, temp read=8991 written=8991
4. 87.950 11,619.025 ↑ 10.7 14,566 1

Unique (cost=1,043,609.67..1,066,209.75 rows=155,141 width=39) (actual time=10,076.656..11,619.025 rows=14,566 loops=1)

  • Buffers: shared hit=731394, temp read=8991 written=8991
5. 3,277.335 11,531.075 ↑ 5.0 896,532 1

Sort (cost=1,043,609.67..1,054,909.71 rows=4,520,017 width=39) (actual time=10,076.655..11,531.075 rows=896,532 loops=1)

  • Sort Key: sequence_leads_1.email DESC, sequence_leads_1.created_at DESC
  • Sort Method: external merge Disk: 47000kB
  • Buffers: shared hit=731394, temp read=8991 written=8991
6. 2,048.988 8,253.740 ↑ 5.0 896,532 1

Merge Join (cost=71,234.5..296,778.32 rows=4,520,017 width=39) (actual time=353.847..8,253.74 rows=896,532 loops=1)

  • Buffers: shared hit=731388
7. 3,128.819 5,949.524 ↑ 1.8 15,105,334 1

Merge Join (cost=45,486.63..1,287,106.85 rows=27,692,724 width=41) (actual time=10.886..5,949.524 rows=15,105,334 loops=1)

  • Buffers: shared hit=713613
8. 1,316.444 1,316.444 ↑ 1.0 5,728,076 1

Index Scan using index_sequence_lead_data_fields_on_sequence_lead_id on sequence_lead_data_fields sequence_lead_data_fields (cost=0.43..752,865.26 rows=5,757,282 width=33) (actual time=0.006..1,316.444 rows=5,728,076 loops=1)

  • Buffers: shared hit=221110
9. 848.769 1,504.261 ↓ 2.4 15,106,338 1

Materialize (cost=0.43..808,503.87 rows=6,327,717 width=8) (actual time=0.079..1,504.261 rows=15,106,338 loops=1)

  • Buffers: shared hit=492503
10. 655.492 655.492 ↑ 6.1 1,038,131 1

Index Only Scan using index_email_messages_on_sequence_lead_id on email_messages email_messages (cost=0.43..792,684.58 rows=6,327,717 width=8) (actual time=0.05..655.492 rows=1,038,131 loops=1)

  • Heap Fetches: 269531
  • Buffers: shared hit=492503
11. 93.665 255.228 ↓ 39.6 1,086,655 1

Sort (cost=25,693.08..25,761.61 rows=27,414 width=39) (actual time=171.867..255.228 rows=1,086,655 loops=1)

  • Sort Key: sequence_leads_1.id
  • Sort Method: quicksort Memory: 2863kB
  • Buffers: shared hit=17775
12. 37.281 161.563 ↑ 1.1 25,981 1

Hash Join (cost=749.12..23,672.31 rows=27,414 width=39) (actual time=6.89..161.563 rows=25,981 loops=1)

  • Buffers: shared hit=17771
13. 117.451 117.451 ↓ 1.0 395,500 1

Seq Scan on sequence_leads sequence_leads_1 (cost=0..21,178.4 rows=392,140 width=47) (actual time=0.023..117.451 rows=395,500 loops=1)

  • Buffers: shared hit=17257
14. 0.584 6.831 ↓ 3.0 2,864 1

Hash (cost=737.01..737.01 rows=969 width=8) (actual time=6.831..6.831 rows=2,864 loops=1)

  • Buffers: shared hit=514
15. 2.526 6.247 ↓ 3.0 2,864 1

Hash Join (cost=52.81..737.01 rows=969 width=8) (actual time=0.35..6.247 rows=2,864 loops=1)

  • Buffers: shared hit=514
16. 3.422 3.422 ↓ 1.0 13,939 1

Seq Scan on sequences sequences (cost=0..622.55 rows=13,855 width=16) (actual time=0.006..3.422 rows=13,939 loops=1)

  • Buffers: shared hit=484
17. 0.011 0.299 ↑ 1.0 23 1

Hash (cost=52.53..52.53 rows=23 width=8) (actual time=0.299..0.299 rows=23 loops=1)

  • Buffers: shared hit=30
18. 0.012 0.288 ↑ 1.0 23 1

Nested Loop (cost=4.45..52.53 rows=23 width=8) (actual time=0.107..0.288 rows=23 loops=1)

  • Buffers: shared hit=30
19. 0.060 0.060 ↑ 1.0 1 1

Seq Scan on accounts accounts (cost=0..6.01 rows=1 width=16) (actual time=0.039..0.06 rows=1 loops=1)

  • Filter: (accounts.id = 'e15e7392-26a7-4dc9-b8bf-3f93de9b23f6'::uuid)
  • Buffers: shared hit=4
20. 0.172 0.216 ↑ 1.0 23 1

Bitmap Heap Scan on users users (cost=4.45..46.28 rows=23 width=24) (actual time=0.06..0.216 rows=23 loops=1)

  • Heap Blocks: exact=24
  • Buffers: shared hit=26
21. 0.044 0.044 ↓ 1.3 30 1

Bitmap Index Scan on index_users_on_account_id (cost=0..4.45 rows=23 width=0) (actual time=0.044..0.044 rows=30 loops=1)

  • Index Cond: (users.account_id = 'e15e7392-26a7-4dc9-b8bf-3f93de9b23f6'::uuid)
  • Buffers: shared hit=2
22. 29.132 29.132 ↑ 1.0 1 14,566

Index Only Scan using sequence_leads_pkey on sequence_leads sequence_leads (cost=0.42..5.66 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=14,566)

  • Index Cond: (sequence_leads.id = sequence_leads_1.id)
  • Heap Fetches: 5511
  • Buffers: shared hit=49418
Planning time : 6.115 ms
Execution time : 11,676.812 ms