explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AAkI

Settings
# exclusive inclusive rows x rows loops node
1. 0.041 24,516.905 ↑ 1.0 1 1

GroupAggregate (cost=382,889.78..383,145.14 rows=1 width=76) (actual time=24,516.904..24,516.905 rows=1 loops=1)

  • Group Key: parent_comments.id
2. 0.005 24,516.864 ↓ 3.0 3 1

Nested Loop (cost=382,889.78..383,145.12 rows=1 width=131) (actual time=24,516.801..24,516.864 rows=3 loops=1)

3. 0.010 24,516.820 ↓ 3.0 3 1

Nested Loop Left Join (cost=382,889.49..383,136.80 rows=1 width=12) (actual time=24,516.766..24,516.820 rows=3 loops=1)

  • Join Filter: ((parent_comment_likes.origin_id)::text = (parent_comments.origin_id)::text)
  • Rows Removed by Join Filter: 12
4. 0.007 24,516.726 ↓ 3.0 3 1

Merge Left Join (cost=382,889.06..382,889.08 rows=1 width=41) (actual time=24,516.722..24,516.726 rows=3 loops=1)

  • Merge Cond: (parent_comments.id = sub_comments.parent_id)
5. 0.013 0.063 ↑ 1.0 1 1

Sort (cost=247.69..247.70 rows=1 width=37) (actual time=0.063..0.063 rows=1 loops=1)

  • Sort Key: parent_comments.id
  • Sort Method: quicksort Memory: 25kB
6. 0.050 0.050 ↑ 1.0 1 1

Index Scan using index_social_activity_interactions_on_social_activity_id on social_activity_interactions parent_comments (cost=0.43..247.68 rows=1 width=37) (actual time=0.018..0.050 rows=1 loops=1)

  • Index Cond: (social_activity_id = 149254)
  • Filter: ((parent_id IS NULL) AND ((action_type)::text = 'comment'::text))
  • Rows Removed by Filter: 118
7. 0.008 24,516.656 ↓ 3.0 3 1

Sort (cost=382,641.36..382,641.37 rows=1 width=8) (actual time=24,516.655..24,516.656 rows=3 loops=1)

  • Sort Key: sub_comments.parent_id
  • Sort Method: quicksort Memory: 25kB
8. 0.003 24,516.648 ↓ 3.0 3 1

Subquery Scan on sub_comments (cost=382,641.33..382,641.35 rows=1 width=8) (actual time=24,516.644..24,516.648 rows=3 loops=1)

9. 0.006 24,516.645 ↓ 3.0 3 1

GroupAggregate (cost=382,641.33..382,641.34 rows=1 width=80) (actual time=24,516.643..24,516.645 rows=3 loops=1)

  • Group Key: sub_comments_1.id
10. 0.016 24,516.639 ↓ 3.0 3 1

Sort (cost=382,641.33..382,641.33 rows=1 width=8) (actual time=24,516.638..24,516.639 rows=3 loops=1)

  • Sort Key: sub_comments_1.id
  • Sort Method: quicksort Memory: 25kB
11. 0.012 24,516.623 ↓ 3.0 3 1

Nested Loop (cost=1,053.70..382,641.32 rows=1 width=8) (actual time=24,516.612..24,516.623 rows=3 loops=1)

12. 105.498 24,516.560 ↓ 3.0 3 1

Hash Right Join (cost=1,053.41..382,633.00 rows=1 width=8) (actual time=24,516.558..24,516.560 rows=3 loops=1)

  • Hash Cond: ((sub_comment_likes.origin_id)::text = (sub_comments_1.origin_id)::text)
13. 60.318 24,410.473 ↓ 1.0 433,071 1

Gather (cost=1,000.00..381,021.37 rows=415,523 width=33) (actual time=0.248..24,410.473 rows=433,071 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
14. 24,350.155 24,350.155 ↑ 1.2 144,357 3

Parallel Seq Scan on social_activity_interactions sub_comment_likes (cost=0.00..338,469.07 rows=173,135 width=33) (actual time=2.727..24,350.155 rows=144,357 loops=3)

  • Filter: ((action_type)::text = 'reaction'::text)
  • Rows Removed by Filter: 4914943
15. 0.004 0.589 ↓ 3.0 3 1

Hash (cost=53.40..53.40 rows=1 width=41) (actual time=0.589..0.589 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 0.007 0.585 ↓ 3.0 3 1

Bitmap Heap Scan on social_activity_interactions sub_comments_1 (cost=49.38..53.40 rows=1 width=41) (actual time=0.583..0.585 rows=3 loops=1)

  • Recheck Cond: ((social_activity_id = 149254) AND (parent_id IS NOT NULL))
  • Filter: ((action_type)::text = 'comment'::text)
  • Heap Blocks: exact=1
17. 0.013 0.578 ↓ 0.0 0 1

BitmapAnd (cost=49.38..49.38 rows=1 width=0) (actual time=0.578..0.578 rows=0 loops=1)

18. 0.013 0.013 ↓ 1.2 119 1

Bitmap Index Scan on index_social_activity_interactions_on_social_activity_id (cost=0.00..5.19 rows=101 width=0) (actual time=0.013..0.013 rows=119 loops=1)

  • Index Cond: (social_activity_id = 149254)
19. 0.552 0.552 ↓ 2.1 4,387 1

Bitmap Index Scan on index_social_activity_interactions_on_parent_id (cost=0.00..43.94 rows=2,067 width=0) (actual time=0.552..0.552 rows=4,387 loops=1)

  • Index Cond: (parent_id IS NOT NULL)
20. 0.051 0.051 ↑ 1.0 1 3

Index Only Scan using index_comment_contents_on_social_activity_interaction_id on comment_contents sub_comment_contents (cost=0.29..8.30 rows=1 width=4) (actual time=0.017..0.017 rows=1 loops=3)

  • Index Cond: (social_activity_interaction_id = sub_comments_1.id)
  • Heap Fetches: 0
21. 0.084 0.084 ↓ 1.3 4 3

Index Scan using index_social_activity_interactions_on_social_activity_id on social_activity_interactions parent_comment_likes (cost=0.43..247.68 rows=3 width=37) (actual time=0.009..0.028 rows=4 loops=3)

  • Index Cond: (social_activity_id = 149254)
  • Filter: ((action_type)::text = 'reaction'::text)
  • Rows Removed by Filter: 115
22. 0.039 0.039 ↑ 1.0 1 3

Index Scan using index_comment_contents_on_social_activity_interaction_id on comment_contents parent_comment_contents (cost=0.29..8.30 rows=1 width=123) (actual time=0.012..0.013 rows=1 loops=3)

  • Index Cond: (social_activity_interaction_id = parent_comments.id)