explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZWPt : test

Settings
# exclusive inclusive rows x rows loops node
1. 5.916 58.855 ↓ 463.7 7,419 1

Sort (cost=972.94..972.98 rows=16 width=61) (actual time=57.487..58.855 rows=7,419 loops=1)

  • Sort Key: r.pick, (((1.0 * (r.frequency)::numeric) / (t.frequency)::numeric)) DESC
  • Sort Method: quicksort Memory: 650kB
2.          

CTE results

3. 6.714 10.243 ↓ 5.0 7,419 1

HashAggregate (cost=368.28..383.07 rows=1,479 width=16) (actual time=7.639..10.243 rows=7,419 loops=1)

  • Group Key: res.rn_player_id, res.pick, res.num_picked
4. 3.529 3.529 ↑ 1.0 7,419 1

Seq Scan on draft_simulation_results res (cost=0.00..294.09 rows=7,419 width=10) (actual time=0.514..3.529 rows=7,419 loops=1)

  • Filter: (num_picked = 1)
  • Rows Removed by Filter: 7388
5.          

CTE total_picks

6. 2.720 5.047 ↑ 2.0 216 1

HashAggregate (cost=349.73..354.07 rows=434 width=12) (actual time=4.958..5.047 rows=216 loops=1)

  • Group Key: res_1.pick, res_1.num_picked
7. 2.327 2.327 ↑ 1.0 7,419 1

Seq Scan on draft_simulation_results res_1 (cost=0.00..294.09 rows=7,419 width=6) (actual time=0.028..2.327 rows=7,419 loops=1)

  • Filter: (num_picked = 1)
  • Rows Removed by Filter: 7388
8. 7.662 52.939 ↓ 463.7 7,419 1

Nested Loop Left Join (cost=135.56..235.48 rows=16 width=61) (actual time=22.172..52.939 rows=7,419 loops=1)

9. 5.312 30.439 ↓ 463.7 7,419 1

Merge Join (cost=135.14..149.65 rows=16 width=24) (actual time=22.107..30.439 rows=7,419 loops=1)

  • Merge Cond: ((r.pick = t.pick) AND (r.num_picked = t.num_picked))
10. 4.142 18.428 ↓ 5.0 7,419 1

Sort (cost=107.45..111.15 rows=1,479 width=16) (actual time=16.852..18.428 rows=7,419 loops=1)

  • Sort Key: r.pick, r.num_picked
  • Sort Method: quicksort Memory: 418kB
11. 14.286 14.286 ↓ 5.0 7,419 1

CTE Scan on results r (cost=0.00..29.58 rows=1,479 width=16) (actual time=7.643..14.286 rows=7,419 loops=1)

12. 1.529 6.699 ↓ 17.0 7,384 1

Sort (cost=27.69..28.78 rows=434 width=12) (actual time=5.250..6.699 rows=7,384 loops=1)

  • Sort Key: t.pick, t.num_picked
  • Sort Method: quicksort Memory: 25kB
13. 5.170 5.170 ↑ 2.0 216 1

CTE Scan on total_picks t (cost=0.00..8.68 rows=434 width=12) (actual time=4.959..5.170 rows=216 loops=1)

14. 14.838 14.838 ↑ 1.0 1 7,419

Index Scan using rn_players_pkey on rn_players pl (cost=0.42..5.35 rows=1 width=17) (actual time=0.002..0.002 rows=1 loops=7,419)

  • Index Cond: (r.rn_player_id = rn_player_id)
Planning time : 2.019 ms