explain.depesz.com

PostgreSQL's explain analyze made readable

Result: isUi : Optimization for: plan #GdT8

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 28.553 ↑ 1.0 6 1

Limit (cost=1,884.13..1,884.14 rows=6 width=1,688) (actual time=28.552..28.553 rows=6 loops=1)

2. 13.939 28.551 ↑ 6.7 6 1

Sort (cost=1,884.13..1,884.23 rows=40 width=1,688) (actual time=28.550..28.551 rows=6 loops=1)

  • Sort Key: topic_links.clicks DESC, topic_links.created_at DESC
  • Sort Method: top-N heapsort Memory: 49kB
3. 4.905 14.612 ↓ 320.0 12,800 1

Nested Loop (cost=6.54..1,883.41 rows=40 width=1,688) (actual time=0.105..14.612 rows=12,800 loops=1)

4. 0.293 4.587 ↓ 320.0 320 1

Nested Loop (cost=6.54..1,876.49 rows=1 width=1,684) (actual time=0.091..4.587 rows=320 loops=1)

5. 0.173 3.334 ↓ 320.0 320 1

Nested Loop (cost=6.12..1,869.40 rows=1 width=746) (actual time=0.069..3.334 rows=320 loops=1)

6. 0.331 0.353 ↓ 2.4 104 1

Bitmap Heap Scan on topics (cost=5.70..629.41 rows=44 width=575) (actual time=0.044..0.353 rows=104 loops=1)

  • Recheck Cond: ((user_id = 8,722) AND (deleted_at IS NULL))
  • Filter: (visible AND ((archetype)::text <> 'private_message'::text))
  • Rows Removed by Filter: 65
  • Heap Blocks: exact=167
7. 0.022 0.022 ↓ 1.0 175 1

Bitmap Index Scan on idx_topics_user_id_deleted_at (cost=0.00..5.69 rows=169 width=0) (actual time=0.022..0.022 rows=175 loops=1)

  • Index Cond: (user_id = 8,722)
8. 2.808 2.808 ↓ 3.0 3 104

Index Scan using index_forum_thread_links_on_forum_thread_id on topic_links (cost=0.42..28.17 rows=1 width=171) (actual time=0.020..0.027 rows=3 loops=104)

  • Index Cond: (topic_id = topics.id)
  • Filter: ((NOT internal) AND (NOT reflection) AND (NOT quote) AND (user_id = 8,722))
  • Rows Removed by Filter: 6
9. 0.960 0.960 ↑ 1.0 1 320

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

  • Index Cond: (id = topic_links.post_id)
  • Filter: ((user_id = 8,722) AND (post_type = ANY ('{1,2,3,4}'::integer[])))
10. 5.120 5.120 ↑ 1.0 40 320

Seq Scan on categories (cost=0.00..6.52 rows=40 width=0) (actual time=0.001..0.016 rows=40 loops=320)

  • Filter: (read_restricted IS FALSE)
  • Rows Removed by Filter: 12
Planning time : 1.193 ms
Execution time : 28.672 ms