explain.depesz.com

PostgreSQL's explain analyze made readable

Result: H9d0

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

Limit (cost=33,175.24..33,175.94 rows=6 width=1,688) (actual time=116.527..116.531 rows=6 loops=1)

2. 13.129 124.287 ↑ 111.3 6 1

Gather Merge (cost=33,175.24..33,253.18 rows=668 width=1,688) (actual time=116.526..124.287 rows=6 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 6.014 111.158 ↑ 66.8 5 3 / 3

Sort (cost=32,175.21..32,176.05 rows=334 width=1,688) (actual time=111.157..111.158 rows=5 loops=3)

  • Sort Key: topic_links.clicks DESC, topic_links.created_at DESC
  • Sort Method: top-N heapsort Memory: 48kB
  • Worker 0: Sort Method: top-N heapsort Memory: 52kB
  • Worker 1: Sort Method: top-N heapsort Memory: 51kB
4. 1.633 105.144 ↓ 3.1 1,046 3 / 3

Nested Loop (cost=16,627.42..32,169.23 rows=334 width=1,688) (actual time=87.222..105.144 rows=1,046 loops=3)

5. 26.059 97.233 ↓ 2.9 1,046 3 / 3

Parallel Hash Join (cost=16,626.99..29,967.74 rows=359 width=746) (actual time=87.182..97.233 rows=1,046 loops=3)

  • Hash Cond: (topic_links.topic_id = topics.id)
6. 9.416 10.027 ↑ 1.1 1,836 3 / 3

Parallel Bitmap Heap Scan on topic_links (cost=202.88..12,588.41 rows=1,985 width=171) (actual time=2.897..10.027 rows=1,836 loops=3)

  • Recheck Cond: (user_id = 1)
  • Filter: ((NOT internal) AND (NOT reflection) AND (NOT quote))
  • Rows Removed by Filter: 1,452
  • Heap Blocks: exact=1,487
7. 0.611 0.611 ↑ 1.0 10,276 1 / 3

Bitmap Index Scan on index_topic_links_on_user_id (cost=0.00..201.69 rows=10,302 width=0) (actual time=1.834..1.834 rows=10,276 loops=1)

  • Index Cond: (user_id = 1)
8. 20.284 61.147 ↑ 1.2 9,680 3 / 3

Parallel Hash (cost=15,426.71..15,426.71 rows=11,632 width=575) (actual time=61.146..61.147 rows=9,680 loops=3)

  • Buckets: 8,192 Batches: 8 Memory Usage: 2,144kB
9. 40.823 40.863 ↑ 1.2 9,680 3 / 3

Parallel Seq Scan on topics (cost=7.41..15,426.71 rows=11,632 width=575) (actual time=0.097..40.863 rows=9,680 loops=3)

  • 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: 41,756
10.          

SubPlan (for Parallel Seq Scan)

11. 0.040 0.040 ↓ 1.2 52 3 / 3

Seq Scan on categories (cost=0.00..7.30 rows=43 width=4) (actual time=0.013..0.040 rows=52 loops=3)

  • Filter: ((NOT read_restricted) OR (id = ANY ('{20,25,69,83,87,88,89,90,91,92,93,94}'::integer[])))
12. 6.278 6.278 ↑ 1.0 1 3,139 / 3

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

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