QUERY PLAN
Limit (cost=14558.25..14569.92 rows=100 width=158)
-> Gather Merge (cost=14558.25..15342.08 rows=6718 width=158)
Workers Planned: 2
-> Sort (cost=13558.23..13566.63 rows=3359 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=5749.46..13361.50 rows=3359 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..5682.42 rows=14465 width=153)
Filter: (NOT is_system)
-> Hash (cost=5244.10..5244.10 rows=40429 width=9)
-> Seq Scan on tbl_unread_comments uc (cost=0.00..5244.10 rows=40429 width=9)
Filter: (remind_user_id = 1001)