explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q0QC

Settings
# exclusive inclusive rows x rows loops node
1. 0.600 9.807 ↓ 1.2 234 1

Sort (cost=985.41..985.91 rows=200 width=168) (actual time=9.779..9.807 rows=234 loops=1)

  • Sort Key: user_reactions.alias_id DESC, user_reactions.type, (min(user_reactions.created_at)) DESC
  • Sort Method: quicksort Memory: 87kB
2. 0.367 9.207 ↓ 1.2 234 1

HashAggregate (cost=975.76..977.76 rows=200 width=168) (actual time=9.139..9.207 rows=234 loops=1)

  • Group Key: (CASE WHEN (user_reactions.alias_id IS NOT NULL) THEN NULL::uuid ELSE user_reactions.user_id END), (COALESCE(anonymous_aliases.username, users.username)), (COALESCE(anonymous_aliases.display_name, users.display_name)), user_reactions.ali (...)
3. 0.415 8.840 ↑ 1.0 252 1

HashAggregate (cost=965.86..968.50 rows=264 width=168) (actual time=8.775..8.840 rows=252 loops=1)

  • Group Key: (CASE WHEN (user_reactions.alias_id IS NOT NULL) THEN NULL::uuid ELSE user_reactions.user_id END), user_reactions.alias_id, (COALESCE(anonymous_aliases.username, users.username)), (COALESCE(anonymous_aliases.display_name, users.dis (...)
4. 0.036 8.425 ↑ 1.0 252 1

Append (cost=287.62..961.24 rows=264 width=168) (actual time=4.140..8.425 rows=252 loops=1)

5. 0.124 4.502 ↓ 1.1 194 1

Hash Left Join (cost=287.62..447.74 rows=182 width=141) (actual time=4.138..4.502 rows=194 loops=1)

  • Hash Cond: (user_reactions.alias_id = anonymous_aliases.id)
6. 0.361 4.288 ↓ 1.1 194 1

Hash Join (cost=283.57..442.57 rows=182 width=180) (actual time=4.024..4.288 rows=194 loops=1)

  • Hash Cond: (user_reactions.user_id = users.id)
7. 0.145 0.211 ↓ 1.1 194 1

Bitmap Heap Scan on user_reactions (cost=6.15..162.64 rows=182 width=45) (actual time=0.084..0.211 rows=194 loops=1)

  • Recheck Cond: ((card_id = '85d4dcce-d170-4374-9754-4ba3a03e206e'::uuid) AND (type = 'like'::text))
  • Heap Blocks: exact=47
8. 0.066 0.066 ↓ 1.1 194 1

Bitmap Index Scan on user_reactions_card_id_type_idx (cost=0.00..6.11 rows=182 width=0) (actual time=0.066..0.066 rows=194 loops=1)

  • Index Cond: ((card_id = '85d4dcce-d170-4374-9754-4ba3a03e206e'::uuid) AND (type = 'like'::text))
9. 2.051 3.716 ↑ 1.0 3,352 1

Hash (cost=235.52..235.52 rows=3,352 width=151) (actual time=3.716..3.716 rows=3,352 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 638kB
10. 1.665 1.665 ↑ 1.0 3,352 1

Seq Scan on users (cost=0.00..235.52 rows=3,352 width=151) (actual time=0.008..1.665 rows=3,352 loops=1)

11. 0.051 0.090 ↑ 1.0 91 1

Hash (cost=2.91..2.91 rows=91 width=115) (actual time=0.090..0.090 rows=91 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
12. 0.039 0.039 ↑ 1.0 91 1

Seq Scan on anonymous_aliases (cost=0.00..2.91 rows=91 width=115) (actual time=0.012..0.039 rows=91 loops=1)

13. 0.051 3.887 ↑ 1.4 58 1

Hash Left Join (cost=290.75..510.87 rows=82 width=168) (actual time=3.759..3.887 rows=58 loops=1)

  • Hash Cond: (cards.alias_id = anonymous_aliases_1.id)
14. 0.072 3.767 ↑ 1.4 58 1

Hash Join (cost=286.70..506.19 rows=82 width=175) (actual time=3.669..3.767 rows=58 loops=1)

  • Hash Cond: (cards.owner_id = users_1.id)
15. 0.074 0.125 ↑ 1.4 58 1

Bitmap Heap Scan on cards (cost=9.28..227.64 rows=82 width=40) (actual time=0.063..0.125 rows=58 loops=1)

  • Recheck Cond: ((thread_reply_id = '85d4dcce-d170-4374-9754-4ba3a03e206e'::uuid) OR (thread_root_id = '85d4dcce-d170-4374-9754-4ba3a03e206e'::uuid))
  • Filter: (deleted_at IS NULL)
  • Rows Removed by Filter: 2
  • Heap Blocks: exact=39
16. 0.002 0.051 ↓ 0.0 0 1

BitmapOr (cost=9.28..9.28 rows=89 width=0) (actual time=0.051..0.051 rows=0 loops=1)

17. 0.022 0.022 ↑ 1.0 29 1

Bitmap Index Scan on cards_thread_reply_id_idx (cost=0.00..4.50 rows=29 width=0) (actual time=0.022..0.022 rows=29 loops=1)

  • Index Cond: (thread_reply_id = '85d4dcce-d170-4374-9754-4ba3a03e206e'::uuid)
18. 0.027 0.027 ↑ 1.0 60 1

Bitmap Index Scan on cards_thread_root_id_idx (cost=0.00..4.74 rows=60 width=0) (actual time=0.027..0.027 rows=60 loops=1)

  • Index Cond: (thread_root_id = '85d4dcce-d170-4374-9754-4ba3a03e206e'::uuid)
19. 1.895 3.570 ↑ 1.0 3,352 1

Hash (cost=235.52..235.52 rows=3,352 width=151) (actual time=3.570..3.570 rows=3,352 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 638kB
20. 1.675 1.675 ↑ 1.0 3,352 1

Seq Scan on users users_1 (cost=0.00..235.52 rows=3,352 width=151) (actual time=0.007..1.675 rows=3,352 loops=1)

21. 0.037 0.069 ↑ 1.0 91 1

Hash (cost=2.91..2.91 rows=91 width=115) (actual time=0.069..0.069 rows=91 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
22. 0.032 0.032 ↑ 1.0 91 1

Seq Scan on anonymous_aliases anonymous_aliases_1 (cost=0.00..2.91 rows=91 width=115) (actual time=0.009..0.032 rows=91 loops=1)