QUERY PLAN
Limit (cost=10611.20..10622.17 rows=94 width=163)
-> Gather Merge (cost=10611.20..10622.17 rows=94 width=163)
Workers Planned: 2
-> Sort (cost=9611.18..9611.30 rows=47 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=9540.45..9609.87 rows=47 width=163)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Sort (cost=5356.69..5389.89 rows=13281 width=158)
Sort Key: c.id
-> Parallel Seq Scan on tbl_comments c (cost=0.00..4447.14 rows=13281 width=158)
Filter: (NOT is_system)
-> Sort (cost=4183.76..4184.97 rows=484 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4162.18 rows=484 width=9)
Filter: (remind_user_id = 1000)