QUERY PLAN
Limit (cost=14555.00..14566.67 rows=100 width=158)
-> Gather Merge (cost=14555.00..15338.82 rows=6718 width=158)
Workers Planned: 2
-> Sort (cost=13554.98..13563.38 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=5746.22..13358.24 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=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)