QUERY PLAN
Limit (cost=16597.71..16609.37 rows=100 width=160)
-> Gather Merge (cost=16597.71..16651.38 rows=460 width=160)
Workers Planned: 2
-> Sort (cost=15597.68..15598.26 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=4836.57..15588.66 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..10576.73 rows=67950 width=155)
Filter: is_system
-> Sort (cost=4836.15..4837.46 rows=523 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4812.54 rows=523 width=9)
Filter: (remind_user_id = 5064)