explain.depesz.com

PostgreSQL's explain analyze made readable

Result: iSw9

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

Limit (cost=50,471.16..50,471.86 rows=6 width=1,688) (actual time=174.668..174.671 rows=6 loops=1)

2. 16.784 185.610 ↑ 1,235.3 6 1

Gather Merge (cost=50,471.16..51,335.96 rows=7,412 width=1,688) (actual time=174.666..185.610 rows=6 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 2.485 168.826 ↑ 926.5 4 3 / 3

Sort (cost=49,471.14..49,480.40 rows=3,706 width=1,688) (actual time=168.826..168.826 rows=4 loops=3)

  • Sort Key: topic_links.clicks DESC, topic_links.created_at DESC
  • Sort Method: top-N heapsort Memory: 54kB
  • Worker 0: Sort Method: top-N heapsort Memory: 47kB
  • Worker 1: Sort Method: top-N heapsort Memory: 56kB
4. 1.136 166.341 ↑ 4.8 773 3 / 3

Nested Loop (cost=16,423.88..49,404.71 rows=3,706 width=1,688) (actual time=142.626..166.341 rows=773 loops=3)

5. 30.940 159.796 ↑ 5.2 773 3 / 3

Parallel Hash Join (cost=16,423.46..33,468.24 rows=3,988 width=746) (actual time=142.592..159.796 rows=773 loops=3)

  • Hash Cond: (topic_links.topic_id = topics.id)
6. 66.400 66.400 ↑ 1.3 16,563 3 / 3

Parallel Seq Scan on topic_links (cost=0.00..15,056.93 rows=22,039 width=171) (actual time=0.133..66.400 rows=16,563 loops=3)

  • Filter: ((NOT internal) AND (NOT reflection) AND (NOT quote) AND (user_id = 32))
  • Rows Removed by Filter: 154,952
7. 21.114 62.456 ↑ 1.2 9,439 3 / 3

Parallel Hash (cost=15,426.06..15,426.06 rows=11,632 width=575) (actual time=62.456..62.456 rows=9,439 loops=3)

  • Buckets: 8,192 Batches: 8 Memory Usage: 2,080kB
8. 41.307 41.342 ↑ 1.2 9,439 3 / 3

Parallel Seq Scan on topics (cost=6.75..15,426.06 rows=11,632 width=575) (actual time=0.078..41.342 rows=9,439 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,995
9.          

SubPlan (for Parallel Seq Scan)

10. 0.035 0.035 ↑ 1.0 40 3 / 3

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

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

Index Scan using index_posts_on_id_and_baked_version on posts (cost=0.42..4.00 rows=1 width=938) (actual time=0.007..0.007 rows=1 loops=2,318)

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