explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MRKY

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.003 15,719.066 ↑ 1.0 10 1

Limit (cost=244,052.17..244,052.19 rows=10 width=134) (actual time=15,719.065..15,719.066 rows=10 loops=1)

2. 2.647 15,719.063 ↑ 2,996.4 10 1

Sort (cost=244,052.17..244,127.08 rows=29,964 width=134) (actual time=15,719.062..15,719.063 rows=10 loops=1)

  • Sort Key: (count(DISTINCT orders.o_custkey))
  • Sort Method: top-N heapsort Memory: 26kB
3. 214.022 15,716.416 ↑ 3.0 10,000 1

GroupAggregate (cost=242,805.38..243,404.66 rows=29,964 width=134) (actual time=13,971.874..15,716.416 rows=10,000 loops=1)

  • Group Key: nation.n_name, supplier.s_name
4. 7,705.962 15,502.394 ↓ 17.9 535,027 1

Sort (cost=242,805.38..242,880.29 rows=29,964 width=134) (actual time=13,971.655..15,502.394 rows=535,027 loops=1)

  • Sort Key: nation.n_name, supplier.s_name
  • Sort Method: external merge Disk: 34432kB
5. 161.912 7,796.432 ↓ 17.9 535,027 1

Hash Join (cost=449.00..238,526.41 rows=29,964 width=134) (actual time=4.449..7,796.432 rows=535,027 loops=1)

  • Hash Cond: (supplier.s_nationkey = nation.n_nationkey)
6. 690.785 7,634.495 ↓ 17.9 535,027 1

Hash Join (cost=447.43..238,112.84 rows=29,964 width=34) (actual time=4.415..7,634.495 rows=535,027 loops=1)

  • Hash Cond: (lineitem.l_suppkey = supplier.s_suppkey)
7. 160.214 6,939.327 ↓ 17.8 535,027 1

Nested Loop (cost=0.43..236,916.11 rows=30,006 width=8) (actual time=0.020..6,939.327 rows=535,027 loops=1)

8. 766.078 766.078 ↓ 17.8 133,623 1

Seq Scan on orders (cost=0.00..52,345.00 rows=7,500 width=8) (actual time=0.012..766.078 rows=133,623 loops=1)

  • Filter: (date_part('year'::text, (o_orderdate)::timestamp without time zone) = 1998::double precision)
  • Rows Removed by Filter: 1366377
9. 6,013.035 6,013.035 ↑ 4.0 4 133,623

Index Scan using pklineitem on lineitem (cost=0.43..24.45 rows=16 width=8) (actual time=0.040..0.045 rows=4 loops=133,623)

  • Index Cond: (l_orderkey = orders.o_orderkey)
10. 2.160 4.383 ↑ 1.0 10,000 1

Hash (cost=322.00..322.00 rows=10,000 width=34) (actual time=4.383..4.383 rows=10,000 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 665kB
11. 2.223 2.223 ↑ 1.0 10,000 1

Seq Scan on supplier (cost=0.00..322.00 rows=10,000 width=34) (actual time=0.002..2.223 rows=10,000 loops=1)

12. 0.008 0.025 ↑ 1.0 25 1

Hash (cost=1.25..1.25 rows=25 width=108) (actual time=0.025..0.025 rows=25 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 2kB
13. 0.017 0.017 ↑ 1.0 25 1

Seq Scan on nation (cost=0.00..1.25 rows=25 width=108) (actual time=0.014..0.017 rows=25 loops=1)