QUERY PLAN
Limit (cost=16592.80..16604.47 rows=100 width=160)
-> Gather Merge (cost=16592.80..16646.47 rows=460 width=160)
Workers Planned: 2
-> Sort (cost=15592.78..15593.35 rows=230 width=160)
Sort Key: (CASE WHEN ((c.created_by = 5064) OR uc.is_read) THEN true ELSE false END), c.created_at DESC
-> Merge Left Join (cost=4833.61..15583.75 rows=230 width=160)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 5064) OR (c.created_by = 5064))
-> Parallel Index Scan using tbl_comments_pkey on tbl_comments c (cost=0.42..10574.82 rows=67934 width=155)
Filter: is_system
-> Sort (cost=4833.19..4834.50 rows=523 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4809.58 rows=523 width=9)
Filter: (remind_user_id = 5064)