QUERY PLAN
Limit (cost=13005.91..13017.58 rows=100 width=158)
-> Gather Merge (cost=13005.91..13017.81 rows=102 width=158)
Workers Planned: 2
-> Sort (cost=12005.89..12006.01 rows=51 width=158)
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=11928.35..12004.44 rows=51 width=158)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Sort (cost=6676.30..6712.44 rows=14453 width=153)
Sort Key: c.id
-> Parallel Seq Scan on tbl_comments c (cost=0.00..5677.67 rows=14453 width=153)
Filter: (NOT is_system)
-> Sort (cost=5252.05..5253.59 rows=617 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..5223.45 rows=617 width=9)
Filter: (remind_user_id = 1000)