Advertisement
Ax042

Untitled

Mar 1st, 2025
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. explain analyze SELECT commentvotes.user_id AS commentvotes_user_id, count(commentvotes.user_id) AS count_1
  2. FROM commentvotes JOIN comments ON comments.id = commentvotes.comment_id
  3. WHERE comments.ghost = false AND comments.is_banned = false AND comments.deleted_utc = 0 AND commentvotes.vote_type = 1 AND comments.author_id = 1980 GROUP BY commentvotes.user_id ORDER BY count(commentvotes.user_id) DESC;
  4.  
  5. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  6.  Sort  (cost=70749.90..70756.10 rows=2480 width=12) (actual time=3822.862..3881.672 rows=4348 loops=1)
  7.    Sort Key: (count(commentvotes.user_id)) DESC
  8.    Sort Method: quicksort  Memory: 430kB
  9.    ->  Finalize GroupAggregate  (cost=70287.68..70610.08 rows=2480 width=12) (actual time=3815.283..3879.098 rows=4348 loops=1)
  10.          Group Key: commentvotes.user_id
  11.          ->  Gather Merge  (cost=70287.68..70572.88 rows=2480 width=12) (actual time=3815.274..3876.254 rows=7268 loops=1)
  12.                Workers Planned: 1
  13.                Workers Launched: 1
  14.                ->  Sort  (cost=69287.67..69293.87 rows=2480 width=12) (actual time=3808.996..3809.447 rows=3634 loops=2)
  15.                      Sort Key: commentvotes.user_id
  16.                      Sort Method: quicksort  Memory: 293kB
  17.                      Worker 0:  Sort Method: quicksort  Memory: 297kB
  18.                      ->  Partial HashAggregate  (cost=69123.04..69147.84 rows=2480 width=12) (actual time=3807.327..3807.997 rows=3634 loops=2)
  19.                            Group Key: commentvotes.user_id
  20.                            Batches: 1  Memory Usage: 625kB
  21.                            Worker 0:  Batches: 1  Memory Usage: 721kB
  22.                            ->  Nested Loop  (cost=1.00..68446.39 rows=135331 width=4) (actual time=0.700..3718.044 rows=307736 loops=2)
  23.                                  ->  Parallel Index Scan using comments_author_id_id_idx on comments  (cost=0.43..28058.16 rows=16088 width=4) (actual time=0.238..139.008 rows=14304 loops=2)
  24.                                        Index Cond: (author_id = 1980)
  25.                                        Filter: ((NOT ghost) AND (NOT is_banned) AND (deleted_utc = 0))
  26.                                        Rows Removed by Filter: 291
  27.                                  ->  Index Only Scan using commentvotes_commentid_userid_votetype_idx on commentvotes  (cost=0.56..2.18 rows=33 width=8) (actual time=0.225..0.247 rows=22 loops=28609)
  28.                                        Index Cond: ((comment_id = comments.id) AND (vote_type = 1))
  29.                                        Heap Fetches: 4303
  30.  Planning Time: 3.849 ms
  31.  Execution Time: 3882.337 ms
  32. (26 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement