QUERY PLAN
Limit (cost=16195.97..16207.64 rows=100 width=163)
-> Gather Merge (cost=16195.97..16241.47 rows=390 width=163)
Workers Planned: 2
-> Sort (cost=15195.95..15196.43 rows=195 width=163)
Sort Key: (CASE WHEN ((c.created_by = 1000) OR uc.is_read) THEN true ELSE false END), c.created_at DESC
-> Merge Left Join (cost=4187.14..15188.53 rows=195 width=163)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Parallel Index Scan using tbl_comments_pkey on tbl_comments c (cost=0.42..10857.69 rows=55548 width=158)
Filter: is_system
-> Sort (cost=4186.72..4187.93 rows=484 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4165.14 rows=484 width=9)
Filter: (remind_user_id = 1000)