QUERY PLAN
Limit (cost=14550.09..14561.76 rows=100 width=158)
-> Gather Merge (cost=14550.09..15333.68 rows=6716 width=158)
Workers Planned: 2
-> Sort (cost=13550.06..13558.46 rows=3358 width=158)
Sort Key: (CASE WHEN ((c.created_by = 1001) OR uc.is_read) THEN true ELSE false END), c.created_at DESC
-> Hash Left Join (cost=5742.99..13353.40 rows=3358 width=158)
Hash Cond: (c.id = uc.comment_id)
Filter: ((uc.remind_user_id = 1001) OR (c.created_by = 1001))
-> Parallel Seq Scan on tbl_comments c (cost=0.00..5681.23 rows=14462 width=153)
Filter: (NOT is_system)
-> Hash (cost=5238.20..5238.20 rows=40383 width=9)
-> Seq Scan on tbl_unread_comments uc (cost=0.00..5238.20 rows=40383 width=9)
Filter: (remind_user_id = 1001)