explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Jywi : Optimization for: Optimization for: Optimization for: plan #GdT8; plan #isUi; plan #Dgin

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.001 5.590 ↓ 6.0 6 1

Limit (cost=823.31..823.32 rows=1 width=1,688) (actual time=5.589..5.590 rows=6 loops=1)

2. 0.572 5.589 ↓ 6.0 6 1

Sort (cost=823.31..823.32 rows=1 width=1,688) (actual time=5.588..5.589 rows=6 loops=1)

  • Sort Key: topic_links.clicks DESC, topic_links.created_at DESC
  • Sort Method: top-N heapsort Memory: 49kB
3. 0.434 5.017 ↓ 332.0 332 1

Nested Loop (cost=13.47..823.30 rows=1 width=1,688) (actual time=0.181..5.017 rows=332 loops=1)

4. 0.140 3.587 ↓ 332.0 332 1

Nested Loop (cost=13.04..815.75 rows=1 width=746) (actual time=0.159..3.587 rows=332 loops=1)

5. 0.046 0.327 ↓ 7.5 60 1

Hash Join (cost=12.62..590.45 rows=8 width=575) (actual time=0.079..0.327 rows=60 loops=1)

  • Hash Cond: (topics.category_id = categories.id)
6. 0.228 0.244 ↓ 1.6 67 1

Bitmap Heap Scan on topics (cost=5.60..583.32 rows=41 width=575) (actual time=0.034..0.244 rows=67 loops=1)

  • Recheck Cond: ((user_id = 19) AND (deleted_at IS NULL))
  • Filter: (visible AND ((archetype)::text <> 'private_message'::text))
  • Rows Removed by Filter: 48
  • Heap Blocks: exact=115
7. 0.016 0.016 ↑ 1.3 120 1

Bitmap Index Scan on idx_topics_user_id_deleted_at (cost=0.00..5.59 rows=156 width=0) (actual time=0.016..0.016 rows=120 loops=1)

  • Index Cond: (user_id = 19)
8. 0.008 0.037 ↑ 1.0 40 1

Hash (cost=6.52..6.52 rows=40 width=4) (actual time=0.037..0.037 rows=40 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
9. 0.029 0.029 ↑ 1.0 40 1

Seq Scan on categories (cost=0.00..6.52 rows=40 width=4) (actual time=0.006..0.029 rows=40 loops=1)

  • Filter: (read_restricted IS FALSE)
  • Rows Removed by Filter: 12
10. 3.120 3.120 ↓ 6.0 6 60

Index Scan using index_forum_thread_links_on_forum_thread_id on topic_links (cost=0.42..28.15 rows=1 width=171) (actual time=0.022..0.052 rows=6 loops=60)

  • Index Cond: (topic_id = topics.id)
  • Filter: ((NOT internal) AND (NOT reflection) AND (NOT quote) AND (user_id = 19))
  • Rows Removed by Filter: 23
11. 0.996 0.996 ↑ 1.0 1 332

Index Scan using index_posts_on_id_and_baked_version on posts (cost=0.42..7.55 rows=1 width=938) (actual time=0.003..0.003 rows=1 loops=332)

  • Index Cond: (id = topic_links.post_id)
  • Filter: ((user_id = 19) AND (post_type = ANY ('{1,2,3,4}'::integer[])))
Planning time : 1.232 ms
Execution time : 5.702 ms