explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QNYk : Optimization for: plan #pO95

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.003 163.671 ↑ 1.0 1 1

Limit (cost=7,701.37..16,138.57 rows=1 width=1,139) (actual time=163.663..163.671 rows=1 loops=1)

2. 0.069 163.668 ↑ 1.0 1 1

Nested Loop (cost=7,701.37..16,138.57 rows=1 width=1,139) (actual time=163.661..163.668 rows=1 loops=1)

3. 0.006 44.985 ↑ 1.0 1 1

Nested Loop (cost=7,701.37..7,714.61 rows=1 width=867) (actual time=44.980..44.985 rows=1 loops=1)

4. 0.042 44.962 ↑ 1.0 1 1

Nested Loop (cost=7,700.95..7,706.47 rows=1 width=847) (actual time=44.958..44.962 rows=1 loops=1)

  • Join Filter: (questions.user_id = fa_questions.user_id)
  • Rows Removed by Join Filter: 84
5. 0.020 0.149 ↑ 1.0 1 1

Merge Left Join (cost=11.50..11.82 rows=1 width=843) (actual time=0.147..0.149 rows=1 loops=1)

  • Merge Cond: (questions.id = comments_fa_count.fa_id)
6. 0.024 0.035 ↑ 1.0 1 1

Sort (cost=8.03..8.04 rows=1 width=839) (actual time=0.034..0.035 rows=1 loops=1)

  • Sort Key: questions.id DESC
  • Sort Method: quicksort Memory: 25kB
7. 0.011 0.011 ↑ 1.0 1 1

Index Scan using fa_question_k_url on fa_questions questions (cost=0.00..8.02 rows=1 width=839) (actual time=0.009..0.011 rows=1 loops=1)

  • Index Cond: ((url)::text = 'kakoj-film-nikity-mixalkova-poluchil-premiyu-oskar'::text)
  • Filter: (fa_themes_id = 10)
8. 0.056 0.094 ↑ 1.7 37 1

Sort (cost=3.47..3.62 rows=62 width=8) (actual time=0.080..0.094 rows=37 loops=1)

  • Sort Key: comments_fa_count.fa_id DESC
  • Sort Method: quicksort Memory: 28kB
9. 0.038 0.038 ↓ 1.0 65 1

Seq Scan on comments_fa_count (cost=0.00..1.62 rows=62 width=8) (actual time=0.007..0.038 rows=65 loops=1)

10. 20.688 44.771 ↑ 1.9 85 1

HashAggregate (cost=7,689.45..7,691.05 rows=160 width=4) (actual time=44.722..44.771 rows=85 loops=1)

  • Group Key: fa_questions.user_id
11. 24.083 24.083 ↓ 1.0 36,287 1

Seq Scan on fa_questions (cost=0.00..7,598.76 rows=36,276 width=4) (actual time=0.004..24.083 rows=36,287 loops=1)

12. 0.017 0.017 ↑ 1.0 1 1

Index Scan using users_pk on users (cost=0.42..8.14 rows=1 width=28) (actual time=0.017..0.017 rows=1 loops=1)

  • Index Cond: (id = fa_questions.user_id)
13. 0.013 0.013 ↑ 1.0 1 1

Seq Scan on fa_themes themes (cost=0.00..1.07 rows=1 width=226) (actual time=0.012..0.013 rows=1 loops=1)

  • Filter: (id = 10)
  • Rows Removed by Filter: 5
14.          

SubPlan (forNested Loop)

15. 0.022 93.788 ↑ 1,000.0 1 1

Sort (cost=3,101.87..3,104.37 rows=1,000 width=36) (actual time=93.787..93.788 rows=1 loops=1)

  • Sort Key: i.i
  • Sort Method: quicksort Memory: 25kB
16. 0.273 93.766 ↑ 1,000.0 1 1

Hash Join (cost=3,029.41..3,052.04 rows=1,000 width=36) (actual time=93.763..93.766 rows=1 loops=1)

  • Hash Cond: ((questions.person_ids)[i.i] = prop.id)
17. 0.015 0.015 ↑ 1,000.0 1 1

Function Scan on generate_subscripts i (cost=0.00..10.00 rows=1,000 width=4) (actual time=0.013..0.015 rows=1 loops=1)

18. 50.086 93.478 ↑ 1.0 69,874 1

Hash (cost=2,151.96..2,151.96 rows=70,196 width=51) (actual time=93.478..93.478 rows=69,874 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 5808kB
19. 43.392 43.392 ↑ 1.0 69,874 1

Seq Scan on persons prop (cost=0.00..2,151.96 rows=70,196 width=51) (actual time=0.011..43.392 rows=69,874 loops=1)

20. 0.014 0.043 ↑ 1,000.0 1 1

Sort (cost=4,483.33..4,485.83 rows=1,000 width=29) (actual time=0.043..0.043 rows=1 loops=1)

  • Sort Key: i_1.i
  • Sort Method: quicksort Memory: 25kB
21. 0.008 0.029 ↑ 1,000.0 1 1

Nested Loop (cost=0.29..4,433.50 rows=1,000 width=29) (actual time=0.027..0.029 rows=1 loops=1)

22. 0.009 0.009 ↑ 1,000.0 1 1

Function Scan on generate_subscripts i_1 (cost=0.00..10.00 rows=1,000 width=4) (actual time=0.008..0.009 rows=1 loops=1)

23. 0.012 0.012 ↑ 1.0 1 1

Index Scan using movies_pk on movies (cost=0.29..4.42 rows=1 width=29) (actual time=0.011..0.012 rows=1 loops=1)

  • Index Cond: (id = (questions.movie_ids)[i_1.i])
24. 0.009 11.768 ↑ 1,000.0 1 1

Sort (cost=413.79..416.29 rows=1,000 width=21) (actual time=11.767..11.768 rows=1 loops=1)

  • Sort Key: i_2.i
  • Sort Method: quicksort Memory: 25kB
25. 0.046 11.759 ↑ 1,000.0 1 1

Hash Join (cost=351.34..363.96 rows=1,000 width=21) (actual time=11.756..11.759 rows=1 loops=1)

  • Hash Cond: ((questions.fa_tags_ids)[i_2.i] = fa_tags.id)
26. 0.008 0.008 ↑ 1,000.0 1 1

Function Scan on generate_subscripts i_2 (cost=0.00..10.00 rows=1,000 width=4) (actual time=0.006..0.008 rows=1 loops=1)

27. 6.109 11.705 ↑ 1.0 10,326 1

Hash (cost=222.26..222.26 rows=10,326 width=25) (actual time=11.704..11.705 rows=10,326 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 741kB
28. 5.596 5.596 ↑ 1.0 10,326 1

Seq Scan on fa_tags (cost=0.00..222.26 rows=10,326 width=25) (actual time=0.012..5.596 rows=10,326 loops=1)

29. 0.012 13.002 ↑ 1,000.0 1 1

Sort (cost=413.79..416.29 rows=1,000 width=34) (actual time=13.001..13.002 rows=1 loops=1)

  • Sort Key: i_3.i
  • Sort Method: quicksort Memory: 25kB
30. 0.043 12.990 ↑ 1,000.0 1 1

Hash Join (cost=351.34..363.96 rows=1,000 width=34) (actual time=12.987..12.990 rows=1 loops=1)

  • Hash Cond: ((questions.fa_tags_ids)[i_3.i] = fa_tags_1.id)
31. 0.011 0.011 ↑ 1,000.0 1 1

Function Scan on generate_subscripts i_3 (cost=0.00..10.00 rows=1,000 width=4) (actual time=0.009..0.011 rows=1 loops=1)

32. 7.196 12.936 ↑ 1.0 10,326 1

Hash (cost=222.26..222.26 rows=10,326 width=38) (actual time=12.936..12.936 rows=10,326 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 876kB
33. 5.740 5.740 ↑ 1.0 10,326 1

Seq Scan on fa_tags fa_tags_1 (cost=0.00..222.26 rows=10,326 width=38) (actual time=0.011..5.740 rows=10,326 loops=1)