explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GdT8

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 17.089 ↑ 1.0 6 1

Limit (cost=21,455.42..21,456.12 rows=6 width=1,688) (actual time=17.086..17.089 rows=6 loops=1)

2. 7.111 19.526 ↑ 48.7 6 1

Gather Merge (cost=21,455.42..21,489.49 rows=292 width=1,688) (actual time=17.084..19.526 rows=6 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 1.104 12.415 ↑ 29.2 5 3 / 3

Sort (cost=20,455.40..20,455.76 rows=146 width=1,688) (actual time=12.414..12.415 rows=5 loops=3)

  • Sort Key: topic_links.clicks DESC, topic_links.created_at DESC
  • Sort Method: top-N heapsort Memory: 52kB
  • Worker 0: Sort Method: top-N heapsort Memory: 49kB
  • Worker 1: Sort Method: top-N heapsort Memory: 59kB
4. 0.365 11.311 ↓ 2.8 407 3 / 3

Nested Loop (cost=98.46..20,452.78 rows=146 width=1,688) (actual time=1.234..11.311 rows=407 loops=3)

5. 3.970 8.502 ↓ 2.6 407 3 / 3

Nested Loop (cost=98.03..19,333.58 rows=158 width=746) (actual time=1.210..8.502 rows=407 loops=3)

  • -> Index Scan using forum_threads_pkey on topics (cost=7.17..11.84 rows=1 width=575) (actual time=0.005..0.005 rows=1loops=2,162)
6. 3.582 4.532 ↑ 1.2 721 3 / 3

Parallel Bitmap Heap Scan on topic_links (cost=90.86..9,018.41 rows=871 width=171) (actual time=1.117..4.532 rows=721 loops=3)

  • Recheck Cond: (user_id = 8,722)
  • Filter: ((NOT internal) AND (NOT reflection) AND (NOT quote))
  • Rows Removed by Filter: 735
  • Heap Blocks: exact=1,124
  • Index Cond: (id = topic_links.topic_id)
  • Filter: ((deleted_at IS NULL) AND (deleted_at IS NULL) AND visible AND ((archetype)::text <> 'private_message'::text) AND ((category_id IS NULL) OR (hashed SubPlan 1)))
  • Rows Removed by Filter: 0
7. 0.912 0.912 ↓ 1.0 4,673 1 / 3

Bitmap Index Scan on index_topic_links_on_user_id (cost=0.00..90.34 rows=4,522 width=0) (actual time=2.735..2.735 rows=4,673 loops=1)

  • Index Cond: (user_id = 8,722)
8.          

SubPlan (for Parallel Bitmap Heap Scan)

9. 0.038 0.038 ↑ 1.0 40 3 / 3

Seq Scan on categories (cost=0.00..6.65 rows=40 width=4) (actual time=0.013..0.038 rows=40 loops=3)

  • Filter: ((NOT read_restricted) OR (id = ANY ('{3,4}'::integer[])))
  • Rows Removed by Filter: 12
10. 2.444 2.444 ↑ 1.0 1 1,222 / 3

Index Scan using index_posts_on_id_and_baked_version on posts (cost=0.42..7.08 rows=1 width=938) (actual time=0.006..0.006 rows=1 loops=1,222)

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