explain.depesz.com

PostgreSQL's explain analyze made readable

Result: To5M

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.005 0.060 ↓ 0.0 0 1

Limit (cost=98.98..99.11 rows=51 width=613) (actual time=0.060..0.060 rows=0 loops=1)

2.          

CTE outfits

3. 0.000 0.000 ↓ 0.0 0

Unique (cost=32.52..32.93 rows=13 width=33) (never executed)

4. 0.000 0.000 ↓ 0.0 0

Sort (cost=32.52..32.73 rows=82 width=33) (never executed)

  • Sort Key: outfit.id_user_app, (COALESCE(outfit_ranking_temp_a.star_count_at_week, 0)) DESC, (COALESCE(outfit_ranking_temp_a.outfit_post_datetime, '1970-07-16 00:00:00'::timestamp without time zone)) DESC
5. 0.000 0.000 ↓ 0.0 0

Hash Right Join (cost=14.83..29.91 rows=82 width=33) (never executed)

  • Hash Cond: (outfit_ranking_temp_a.id_outfit = outfit.id_outfit)
6. 0.000 0.000 ↓ 0.0 0

Seq Scan on outfit_ranking_temp_a (cost=0.00..13.20 rows=320 width=16) (never executed)

7. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.80..13.80 rows=82 width=17) (never executed)

8. 0.000 0.000 ↓ 0.0 0

Seq Scan on outfit (cost=0.00..13.80 rows=82 width=17) (never executed)

  • Filter: ((NOT private_flag) AND (deleted_at IS NULL))
9. 0.045 0.055 ↓ 0.0 0 1

Sort (cost=66.05..67.00 rows=377 width=613) (actual time=0.055..0.055 rows=0 loops=1)

  • Sort Key: user_ranking_temp_a.follower_count_at_week DESC, user_ranking_temp_a.outfit_star_count_at_week DESC, (COALESCE(user_ranking_temp_a.outfit_post_updated_at, '1970-07-16 00:00:00'::timestamp without time zone)) DESC
  • Sort Method: quicksort Memory: 25kB
10. 0.001 0.010 ↓ 0.0 0 1

Nested Loop (cost=29.20..53.48 rows=377 width=613) (actual time=0.010..0.010 rows=0 loops=1)

11. 0.009 0.009 ↓ 0.0 0 1

Seq Scan on user_app (cost=29.06..40.18 rows=29 width=73) (actual time=0.009..0.009 rows=0 loops=1)

  • Filter: ((deleted_at IS NULL) AND (NOT (hashed SubPlan 2)))
12.          

SubPlan (for Seq Scan)

13. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_block (cost=0.00..29.05 rows=1 width=4) (never executed)

  • Filter: ((deleted_at IS NULL) AND ((id_block_from = 42) OR (id_block_to = 42)))
14. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.14..8.62 rows=13 width=540) (never executed)

15. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.14..8.55 rows=13 width=540) (never executed)

16. 0.000 0.000 ↓ 0.0 0

Index Scan using user_ranking_temp_a_id_user_app_key on user_ranking_temp_a (cost=0.14..8.16 rows=1 width=532) (never executed)

  • Index Cond: (id_user_app = 42)
17. 0.000 0.000 ↓ 0.0 0

CTE Scan on outfits (cost=0.00..0.26 rows=13 width=8) (never executed)