QUERY PLAN
Limit (cost=11312.15..11322.88 rows=92 width=160)
-> Gather Merge (cost=11312.15..11322.88 rows=92 width=160)
Workers Planned: 2
-> Sort (cost=10312.12..10312.24 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=10239.86..10310.85 rows=46 width=160)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Sort (cost=5776.95..5811.07 rows=13649 width=155)
Sort Key: c.id
-> Parallel Seq Scan on tbl_comments c (cost=0.00..4839.50 rows=13649 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)