QUERY PLAN
Limit (cost=21819.38..21819.63 rows=100 width=157)
-> Sort (cost=21819.38..21820.68 rows=518 width=157)
Sort Key: (CASE WHEN ((c.created_by = 1000) OR uc.is_read) THEN true ELSE false END), c.created_at DESC
-> Hash Right Join (cost=14076.41..21799.59 rows=518 width=157)
Hash Cond: (uc.comment_id = c.id)
Filter: ((uc.remind_user_id = 1000) OR (c.created_by = 1000))
-> Gather (cost=1000.00..4831.64 rows=472 width=9)
Workers Planned: 1
-> Parallel Seq Scan on tbl_unread_comments uc (cost=0.00..3784.44 rows=278 width=9)
Filter: (remind_user_id = 1000)
-> Hash (cost=6934.61..6934.61 rows=180704 width=152)
-> Seq Scan on tbl_comments c (cost=0.00..6934.61 rows=180704 width=152)
Filter: is_system