explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bdh

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.009 2,673.296 ↑ 1.0 10 1

Limit (cost=791,011.00..791,011.03 rows=10 width=133) (actual time=2,673.288..2,673.296 rows=10 loops=1)

2. 29.336 2,673.287 ↑ 4,632.2 10 1

Sort (cost=791,011.00..791,126.81 rows=46,322 width=133) (actual time=2,673.286..2,673.287 rows=10 loops=1)

  • Sort Key: d.score
  • Sort Method: top-N heapsort Memory: 29kB
3. 161.977 2,643.951 ↑ 1.0 46,322 1

Merge Join (cost=15,208.79..790,010.00 rows=46,322 width=133) (actual time=166.761..2,643.951 rows=46,322 loops=1)

  • Merge Cond: (d.id = d_1.id)
4. 1,093.863 2,481.974 ↑ 1.0 46,322 1

Nested Loop (cost=8,526.48..781,122.89 rows=46,322 width=133) (actual time=110.791..2,481.974 rows=46,322 loops=1)

  • Group Key: d_1.id
  • Filter: (max((count(v_1.duplicate_candidate_id))) <= 5)
5. 1,169.224 1,388.111 ↑ 1.0 46,322 1

Nested Loop (cost=8,525.92..395,584.13 rows=46,322 width=112) (actual time=110.707..1,388.111 rows=46,322 loops=1)

  • Index Cond: ((id)::text = (d.second_place_id)::text)
  • Group Key: d_1.id, v_1.type
6. 218.887 218.887 ↑ 1.0 46,322 1

GroupAggregate (cost=8,525.36..9,582.15 rows=46,322 width=123) (actual time=110.655..218.887 rows=46,322 loops=1)

  • Group Key: d.id
  • Sort Key: d.id
  • Filter: (NOT fulfilled)
  • Sort Key: v.duplicate_candidate_id
  • Sort Key: d_1.id, v_1.type
  • Sort Method: quicksort Memory: 3537kB
Planning time : 5.572 ms
Execution time : 2,675.975 ms