QUERY PLAN
Limit (cost=17911.73..17914.07 rows=20 width=163)
-> Gather Merge (cost=17911.73..20910.74 rows=25704 width=163)
Workers Planned: 2
-> Sort (cost=16911.71..16943.84 rows=12852 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=4578.99..16034.58 rows=12852 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..4450.68 rows=55577 width=158)
Filter: is_system
-> Hash (cost=4171.06..4171.06 rows=32634 width=9)
-> Seq Scan on tbl_unread_comments uc (cost=0.00..4171.06 rows=32634 width=9)
Filter: (remind_user_id = 1001)