QUERY PLAN
Limit (cost=14553.36..14565.02 rows=100 width=158)
-> Gather Merge (cost=14553.36..15336.94 rows=6716 width=158)
Workers Planned: 2
-> Sort (cost=13553.33..13561.73 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=5746.22..13356.66 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=5241.15..5241.15 rows=40406 width=9)
-> Seq Scan on tbl_unread_comments uc (cost=0.00..5241.15 rows=40406 width=9)
Filter: (remind_user_id = 1001)