QUERY PLAN
Limit (cost=17901.73..17913.40 rows=100 width=163)
-> Gather Merge (cost=17901.73..20900.04 rows=25698 width=163)
Workers Planned: 2
-> Sort (cost=16901.71..16933.83 rows=12849 width=163)
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=4572.48..16024.80 rows=12849 width=163)
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..4449.50 rows=55562 width=158)
Filter: is_system
-> Hash (cost=4165.14..4165.14 rows=32587 width=9)
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4165.14 rows=32587 width=9)
Filter: (remind_user_id = 1001)