explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xnL6

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 2,375.334 ↑ 1.0 3 1

Limit (cost=426,649.38..426,649.38 rows=3 width=12) (actual time=2,375.333..2,375.334 rows=3 loops=1)

2. 0.230 2,375.333 ↑ 8,969.7 3 1

Sort (cost=426,649.38..426,662.83 rows=26,909 width=12) (actual time=2,375.332..2,375.333 rows=3 loops=1)

  • Sort Key: (count(*)) DESC
  • Sort Method: top-N heapsort Memory: 25kB
3. 14.620 2,375.103 ↑ 15.3 1,756 1

HashAggregate (cost=426,499.09..426,579.82 rows=26,909 width=12) (actual time=2,374.750..2,375.103 rows=1,756 loops=1)

  • Group Key: COALESCE(matched_courses.university_id, matched_basic_matchables.university_id, university_matches_1.matchable_id)
4. 2.894 2,360.483 ↓ 1.1 30,210 1

Nested Loop Left Join (cost=0.23..426,472.18 rows=26,909 width=12) (actual time=0.405..2,360.483 rows=30,210 loops=1)

  • Join Filter: ((university_matches_1.matchable_type)::text = 'BasicMatchable'::text)
  • Rows Removed by Join Filter: 15464
5. 22.447 2,297.169 ↓ 1.1 30,210 1

Nested Loop Left Join (cost=0.17..424,705.29 rows=26,909 width=23) (actual time=0.402..2,297.169 rows=30,210 loops=1)

  • Join Filter: ((university_matches_1.matchable_type)::text = 'UniversityCourse'::text)
  • Rows Removed by Join Filter: 4827
6. 24.487 2,184.092 ↓ 1.1 30,210 1

Nested Loop (cost=0.09..422,180.18 rows=26,909 width=19) (actual time=0.362..2,184.092 rows=30,210 loops=1)

7. 2,068.975 2,068.975 ↓ 1.1 30,210 1

Seq Scan on university_matches (cost=0.00..319,957.28 rows=26,909 width=4) (actual time=0.325..2,068.975 rows=30,210 loops=1)

  • Filter: ((created_at >= '2020-02-01 00:00:00'::timestamp without time zone) AND (list_status = 1))
  • Rows Removed by Filter: 10251417
8. 90.630 90.630 ↑ 1.0 1 30,210

Index Scan using university_matches_pkey on university_matches university_matches_1 (cost=0.09..3.80 rows=1 width=23) (actual time=0.003..0.003 rows=1 loops=30,210)

  • Index Cond: (id = university_matches.id)
9. 90.630 90.630 ↑ 1.0 1 30,210

Index Scan using university_courses_pkey on university_courses matched_courses (cost=0.08..0.09 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=30,210)

  • Index Cond: (university_matches_1.matchable_id = id)
10. 60.420 60.420 ↑ 1.0 1 30,210

Index Scan using basic_matchables_pkey on basic_matchables matched_basic_matchables (cost=0.06..0.06 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=30,210)

  • Index Cond: (university_matches_1.matchable_id = id)
Planning time : 1.727 ms
Execution time : 2,375.690 ms