explain.depesz.com

A tool for finding a real cause for slow queries.

Result: BnP

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 209.120 62,286.276 ↑ 1.0 1 1

Aggregate (cost=241,744.61..241,744.62 rows=1 width=0) (actual time=62,286.276..62,286.276 rows=1 loops=1)

2. 3,169.544 62,077.156 ↓ 3.2 202,106 1

GroupAggregate (cost=235,875.66..240,963.03 rows=62,526 width=25) (actual time=56,940.834..62,077.156 rows=202,106 loops=1)

  • Filter: (count(DISTINCT li.product_id) = 1)
3. 46,454.441 58,907.612 ↓ 1.2 665,899 1

Sort (cost=235,875.66..237,310.93 rows=574,106 width=25) (actual time=56,940.681..58,907.612 rows=665,899 loops=1)

  • Sort Key: orders.email_address
  • Sort Method: external merge Disk: 24024kB
4. 1,556.398 12,453.171 ↓ 1.2 665,899 1

Hash Join (cost=87,352.17..180,959.68 rows=574,106 width=25) (actual time=2,258.658..12,453.171 rows=665,899 loops=1)

  • Hash Cond: (li.product_id = products.id)
5. 5,635.808 10,782.706 ↓ 1.2 665,899 1

Hash Join (cost=84,049.57..164,022.06 rows=574,106 width=25) (actual time=2,144.564..10,782.706 rows=665,899 loops=1)

  • Hash Cond: (li.order_id = orders.id)
6. 3,003.646 3,003.646 ↑ 1.0 1,844,039 1

Seq Scan on line_items li (cost=0.00..50,783.97 rows=1,875,797 width=8) (actual time=0.016..3,003.646 rows=1,844,039 loops=1)

7. 688.082 2,143.252 ↓ 1.0 515,850 1

Hash (cost=77,638.93..77,638.93 rows=512,851 width=25) (actual time=2,143.252..2,143.252 rows=515,850 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 29676kB
8. 1,244.362 1,455.170 ↓ 1.0 515,850 1

Bitmap Heap Scan on orders (cost=9,755.04..77,638.93 rows=512,851 width=25) (actual time=219.216..1,455.170 rows=515,850 loops=1)

  • Recheck Cond: (created_on > (now() - '1 year'::interval))
9. 210.808 210.808 ↓ 1.1 553,581 1

Bitmap Index Scan on orders_created_on_idx (cost=0.00..9,626.83 rows=512,851 width=0) (actual time=210.808..210.808 rows=553,581 loops=1)

  • Index Cond: (created_on > (now() - '1 year'::interval))
10. 16.111 114.067 ↑ 1.0 18,321 1

Hash (cost=3,071.71..3,071.71 rows=18,471 width=4) (actual time=114.067..114.067 rows=18,321 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 645kB
11. 97.956 97.956 ↑ 1.0 18,321 1

Seq Scan on products (cost=0.00..3,071.71 rows=18,471 width=4) (actual time=0.046..97.956 rows=18,321 loops=1)