explain.depesz.com

PostgreSQL's explain analyze made readable

Result: wVx1

Settings
# exclusive inclusive rows x rows loops node
1. 1.598 2,716.222 ↓ 1.0 6,323 1

Hash Left Join (cost=598,723.09..620,897.66 rows=6,184 width=101) (actual time=2,615.816..2,716.222 rows=6,323 loops=1)

  • Hash Cond: (donation_people.mappy_state_id = mappy_states.id)
2. 1.729 2,714.602 ↓ 1.0 6,323 1

Nested Loop Left Join (cost=598,720.81..620,797.50 rows=6,184 width=102) (actual time=2,615.777..2,714.602 rows=6,323 loops=1)

3. 27.605 2,687.581 ↓ 1.0 6,323 1

Merge Anti Join (cost=598,720.24..599,165.78 rows=6,184 width=12) (actual time=2,615.733..2,687.581 rows=6,323 loops=1)

  • Merge Cond: (donation_person_amount_election_cycles.donor_id = donation_person_amounts.donor_id)
4. 3.551 830.391 ↑ 1.7 7,111 1

Sort (cost=350,699.18..350,730.10 rows=12,367 width=12) (actual time=829.065..830.391 rows=7,111 loops=1)

  • Sort Key: donation_person_amount_election_cycles.donor_id
  • Sort Method: quicksort Memory: 526kB
5. 649.066 826.840 ↑ 1.7 7,111 1

Bitmap Heap Scan on donation_person_amount_election_cycles (cost=17,447.97..349,858.59 rows=12,367 width=12) (actual time=223.818..826.840 rows=7,111 loops=1)

  • Recheck Cond: (election_cycle = 2020)
  • Filter: (transaction_amount >= '10000'::double precision)
  • Rows Removed by Filter: 947353
  • Heap Blocks: exact=172509
6. 177.774 177.774 ↓ 1.0 1,006,804 1

Bitmap Index Scan on donation_person_amount_election_cycles_election_cycle (cost=0.00..17,444.87 rows=959,308 width=0) (actual time=177.774..177.774 rows=1,006,804 loops=1)

  • Index Cond: (election_cycle = 2020)
7. 854.508 1,829.585 ↓ 5.3 409,511 1

Sort (cost=248,021.06..248,212.67 rows=76,646 width=4) (actual time=1,786.659..1,829.585 rows=409,511 loops=1)

  • Sort Key: donation_person_amounts.donor_id
  • Sort Method: external sort Disk: 7200kB
8. 797.042 975.077 ↓ 5.3 409,511 1

HashAggregate (cost=240,269.88..241,036.34 rows=76,646 width=4) (actual time=842.540..975.077 rows=409,511 loops=1)

  • Group Key: donation_person_amounts.donor_id
9. 178.035 178.035 ↓ 1.0 435,358 1

Index Scan using index_donation_person_amounts_on_recipient_id on donation_person_amounts (cost=0.56..239,188.99 rows=432,354 width=4) (actual time=0.028..178.035 rows=435,358 loops=1)

  • Index Cond: (recipient_id = ANY ('{12053265,197462,153454}'::integer[]))
10. 25.292 25.292 ↑ 1.0 1 6,323

Index Scan using donation_people_pkey on donation_people (cost=0.56..3.49 rows=1 width=94) (actual time=0.004..0.004 rows=1 loops=6,323)

  • Index Cond: (donation_person_amount_election_cycles.donor_id = id)
  • Filter: (deleted_at IS NULL)
11. 0.012 0.022 ↑ 1.0 57 1

Hash (cost=1.57..1.57 rows=57 width=7) (actual time=0.022..0.022 rows=57 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
12. 0.010 0.010 ↑ 1.0 57 1

Seq Scan on mappy_states (cost=0.00..1.57 rows=57 width=7) (actual time=0.005..0.010 rows=57 loops=1)

Planning time : 1.916 ms
Execution time : 2,719.919 ms