explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NwNL

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 742.366 ↑ 10.8 50 1

Finalize GroupAggregate (cost=24,440.02..24,583.58 rows=540 width=162) (actual time=742.175..742.366 rows=50 loops=1)

  • Group Key: state.state_id
2. 0.000 761.200 ↑ 7.2 150 1

Gather Merge (cost=24,440.02..24,566.03 rows=1,080 width=162) (actual time=742.160..761.200 rows=150 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 0.192 2,051.820 ↑ 10.8 50 3

Sort (cost=23,440.00..23,441.35 rows=540 width=162) (actual time=683.936..683.940 rows=50 loops=3)

  • Sort Key: state.state_id
  • Sort Method: quicksort Memory: 32kB
  • Worker 0: Sort Method: quicksort Memory: 32kB
  • Worker 1: Sort Method: quicksort Memory: 32kB
4. 609.321 2,051.628 ↑ 10.8 50 3

Partial HashAggregate (cost=23,408.74..23,415.49 rows=540 width=162) (actual time=683.833..683.876 rows=50 loops=3)

  • Group Key: state.state_id
5. 376.551 1,442.307 ↑ 1.3 333,333 3

Hash Join (cost=4,373.38..18,200.40 rows=416,667 width=131) (actual time=42.394..480.769 rows=333,333 loops=3)

  • Hash Cond: (sale.product_id = product.product_id)
6. 280.776 1,053.603 ↑ 1.3 333,333 3

Hash Join (cost=4,073.38..16,806.19 rows=416,667 width=135) (actual time=38.254..351.201 rows=333,333 loops=3)

  • Hash Cond: (customer.state_id = state.state_id)
7. 539.733 771.810 ↑ 1.3 333,333 3

Parallel Hash Join (cost=4,051.23..15,681.70 rows=416,667 width=17) (actual time=37.896..257.270 rows=333,333 loops=3)

  • Hash Cond: (sale.customer_id = customer.customer_id)
8. 120.777 120.777 ↑ 1.3 333,333 3

Parallel Seq Scan on sale (cost=0.00..10,536.67 rows=416,667 width=17) (actual time=0.013..40.259 rows=333,333 loops=3)

9. 41.757 111.300 ↑ 1.3 33,333 3

Parallel Hash (cost=3,530.40..3,530.40 rows=41,667 width=8) (actual time=37.100..37.100 rows=33,333 loops=3)

  • Buckets: 131072 Batches: 1 Memory Usage: 4992kB
10. 69.543 69.543 ↑ 1.3 33,333 3

Parallel Index Only Scan using customer_index on customer (cost=0.29..3,530.40 rows=41,667 width=8) (actual time=0.698..23.181 rows=33,333 loops=3)

  • Heap Fetches: 100000
11. 0.063 1.017 ↑ 10.8 50 3

Hash (cost=15.40..15.40 rows=540 width=122) (actual time=0.339..0.339 rows=50 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
12. 0.954 0.954 ↑ 10.8 50 3

Seq Scan on state (cost=0.00..15.40 rows=540 width=122) (actual time=0.311..0.318 rows=50 loops=3)

13. 6.087 12.153 ↑ 1.0 10,000 3

Hash (cost=175.00..175.00 rows=10,000 width=4) (actual time=4.051..4.051 rows=10,000 loops=3)

  • Buckets: 16384 Batches: 1 Memory Usage: 480kB
14. 6.066 6.066 ↑ 1.0 10,000 3

Seq Scan on product (cost=0.00..175.00 rows=10,000 width=4) (actual time=0.285..2.022 rows=10,000 loops=3)