explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Lo8n

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 11.865 ↑ 17.3 3 1

Sort (cost=735.16..735.29 rows=52 width=47) (actual time=11.864..11.865 rows=3 loops=1)

  • Sort Key: purchases_and_favorites.last_purchased_or_favorited_at DESC
  • Sort Method: quicksort Memory: 25kB
2. 0.094 11.853 ↑ 17.3 3 1

Hash Join (cost=706.09..733.68 rows=52 width=47) (actual time=11.645..11.853 rows=3 loops=1)

  • Hash Cond: (recipes.id = purchases_and_favorites.recipe_id)
3. 1.441 11.701 ↑ 1.0 1,159 1

HashAggregate (cost=690.70..702.29 rows=1,159 width=337) (actual time=11.531..11.701 rows=1,159 loops=1)

  • Group Key: recipes.id
4. 1.538 10.260 ↑ 1.5 7,361 1

Hash Join (cost=173.99..663.90 rows=10,722 width=37) (actual time=1.434..10.260 rows=7,361 loops=1)

  • Hash Cond: (recipe_ingredient_groups.recipe_id = recipes.id)
5. 1.479 8.233 ↑ 1.5 7,361 1

Hash Join (cost=80.91..542.57 rows=10,722 width=8) (actual time=0.925..8.233 rows=7,361 loops=1)

  • Hash Cond: (recipe_ingredients.recipe_ingredient_group_id = recipe_ingredient_groups.id)
6. 2.019 6.344 ↑ 1.5 7,361 1

Hash Anti Join (cost=42.69..476.10 rows=10,722 width=8) (actual time=0.498..6.344 rows=7,361 loops=1)

  • Hash Cond: ((ingredients.term)::text = "*VALUES*".column1)
7. 2.635 4.299 ↑ 1.0 11,185 1

Hash Join (cost=41.34..337.65 rows=11,185 width=24) (actual time=0.465..4.299 rows=11,185 loops=1)

  • Hash Cond: (recipe_ingredients.ingredient_id = ingredients.id)
8. 1.214 1.214 ↑ 1.0 11,185 1

Seq Scan on recipe_ingredients (cost=0.00..266.85 rows=11,185 width=16) (actual time=0.004..1.214 rows=11,185 loops=1)

9. 0.247 0.450 ↑ 1.0 1,304 1

Hash (cost=25.04..25.04 rows=1,304 width=24) (actual time=0.449..0.450 rows=1,304 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 88kB
10. 0.203 0.203 ↑ 1.0 1,304 1

Seq Scan on ingredients (cost=0.00..25.04 rows=1,304 width=24) (actual time=0.006..0.203 rows=1,304 loops=1)

11. 0.013 0.026 ↑ 1.0 54 1

Hash (cost=0.68..0.68 rows=54 width=32) (actual time=0.026..0.026 rows=54 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
12. 0.013 0.013 ↑ 1.0 54 1

Values Scan on "*VALUES*" (cost=0.00..0.68 rows=54 width=32) (actual time=0.001..0.013 rows=54 loops=1)

13. 0.217 0.410 ↑ 1.0 1,210 1

Hash (cost=23.10..23.10 rows=1,210 width=16) (actual time=0.410..0.410 rows=1,210 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 73kB
14. 0.193 0.193 ↑ 1.0 1,210 1

Seq Scan on recipe_ingredient_groups (cost=0.00..23.10 rows=1,210 width=16) (actual time=0.006..0.193 rows=1,210 loops=1)

15. 0.237 0.489 ↑ 1.0 1,159 1

Hash (cost=78.59..78.59 rows=1,159 width=37) (actual time=0.489..0.489 rows=1,159 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 96kB
16. 0.252 0.252 ↑ 1.0 1,159 1

Seq Scan on recipes (cost=0.00..78.59 rows=1,159 width=37) (actual time=0.004..0.252 rows=1,159 loops=1)

17. 0.003 0.058 ↑ 3.0 3 1

Hash (cost=15.28..15.28 rows=9 width=48) (actual time=0.058..0.058 rows=3 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
18. 0.001 0.055 ↑ 3.0 3 1

Subquery Scan on purchases_and_favorites (cost=14.98..15.28 rows=9 width=48) (actual time=0.050..0.055 rows=3 loops=1)

19. 0.024 0.054 ↑ 3.0 3 1

GroupAggregate (cost=14.98..15.19 rows=9 width=48) (actual time=0.049..0.054 rows=3 loops=1)

  • Group Key: "*SELECT* 1".recipe_id
20. 0.012 0.030 ↑ 1.8 5 1

Sort (cost=14.98..15.01 rows=9 width=48) (actual time=0.030..0.030 rows=5 loops=1)

  • Sort Key: "*SELECT* 1".recipe_id
  • Sort Method: quicksort Memory: 25kB
21. 0.001 0.018 ↑ 1.8 5 1

Append (cost=0.00..14.84 rows=9 width=48) (actual time=0.009..0.018 rows=5 loops=1)

22. 0.001 0.010 ↑ 1.0 3 1

Subquery Scan on *SELECT* 1 (cost=0.00..1.07 rows=3 width=48) (actual time=0.008..0.010 rows=3 loops=1)

23. 0.009 0.009 ↑ 1.0 3 1

Seq Scan on user_recipe_purchases (cost=0.00..1.04 rows=3 width=48) (actual time=0.008..0.009 rows=3 loops=1)

  • Filter: (user_id = 23,168,370)
24. 0.000 0.007 ↑ 3.0 2 1

Subquery Scan on *SELECT* 2 (cost=4.20..13.73 rows=6 width=48) (actual time=0.007..0.007 rows=2 loops=1)

25. 0.004 0.007 ↑ 3.0 2 1

Bitmap Heap Scan on user_recipe_favorites (cost=4.20..13.67 rows=6 width=48) (actual time=0.006..0.007 rows=2 loops=1)

  • Recheck Cond: (user_id = 23,168,370)
  • Heap Blocks: exact=1
26. 0.003 0.003 ↑ 1.2 5 1

Bitmap Index Scan on index_user_recipe_favorites_on_user_id (cost=0.00..4.20 rows=6 width=0) (actual time=0.003..0.003 rows=5 loops=1)

  • Index Cond: (user_id = 23,168,370)
Planning time : 0.990 ms
Execution time : 11.990 ms