explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kGP : JOIN Query

Settings
# exclusive inclusive rows x rows loops node
1. 81,137.428 100,312.956 ↑ 25,000.0 2,000 1

Hash Join (cost=411,895.01..6,678,561.70 rows=50,000,000 width=4) (actual time=50.757..100,312.956 rows=2,000 loops=1)

  • Hash Cond: (purchase.user_id = user.id)
2. 19,142.372 19,142.372 ↑ 1.0 100,000,000 1

Seq Scan on purchase (cost=0.00..1,540,541.00 rows=100,000,000 width=8) (actual time=0.013..19,142.372 rows=100,000,000 loops=1)

3. 28.191 33.156 ↑ 25,000.0 1,000 1

Hash (cost=1,738.01..1,738.01 rows=25,000,000 width=4) (actual time=33.156..33.156 rows=1,000 loops=1)

  • Buckets: 131072 Batches: 512 Memory Usage: 1025kB
4. 1.006 4.965 ↑ 25,000.0 1,000 1

Nested Loop (cost=18.07..1,738.01 rows=25,000,000 width=4) (actual time=0.573..4.965 rows=1,000 loops=1)

5. 0.794 0.959 ↓ 5.0 1,000 1

HashAggregate (cost=17.51..19.51 rows=200 width=4) (actual time=0.551..0.959 rows=1,000 loops=1)

  • Group Key: generate_series(1, 1000)
6. 0.165 0.165 ↑ 1.0 1,000 1

Result (cost=0.00..5.01 rows=1,000 width=4) (actual time=0.006..0.165 rows=1,000 loops=1)

7. 3.000 3.000 ↑ 1.0 1 1,000

Index Scan using user_account_id_idx on user (cost=0.56..8.58 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,000)

  • Index Cond: (account_id = (generate_series(1, 1000)))