QUERY PLAN
Limit (cost=12972.86..12982.43 rows=82 width=157)
-> Gather Merge (cost=12972.86..12982.43 rows=82 width=157)
Workers Planned: 2
-> Sort (cost=11972.84..11972.94 rows=41 width=157)
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=11896.80..11971.74 rows=41 width=157)
Merge Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Sort (cost=6673.44..6709.43 rows=14399 width=152)
Sort Key: c.id
-> Parallel Seq Scan on tbl_comments c (cost=0.00..5678.92 rows=14399 width=152)
Filter: (NOT is_system)
-> Sort (cost=5223.36..5224.54 rows=472 width=9)
Sort Key: uc.comment_id
-> Seq Scan on tbl_unread_comments uc (cost=0.00..5202.40 rows=472 width=9)
Filter: (remind_user_id = 1000)