QUERY PLAN
Limit (cost=11313.57..11324.31 rows=92 width=160)
-> Gather Merge (cost=11313.57..11324.31 rows=92 width=160)
Workers Planned: 2
-> Sort (cost=10313.55..10313.66 rows=46 width=160)
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=10241.27..10312.28 rows=46 width=160)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Sort (cost=5778.36..5812.49 rows=13652 width=155)
Sort Key: c.id
-> Parallel Seq Scan on tbl_comments c (cost=0.00..4840.69 rows=13652 width=155)
Filter: (NOT is_system)
-> Sort (cost=4462.90..4464.00 rows=438 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4443.69 rows=438 width=9)
Filter: (remind_user_id = 1000)