| Aggregate (cost=13336.17..13336.18 rows=1 width=8) |
| -> Sort (cost=13216.26..13236.24 rows=7994 width=248) |
| Sort Key: (CASE WHEN ((c.created_by = 1001) OR uc.is_read) THEN true ELSE false END), c.created_at DESC |
| -> Hash Right Join (cost=7368.11..12698.06 rows=7994 width=248) |
| Hash Cond: (uc.comment_id = c.id) |
| Filter: ((uc.remind_user_id = 1001) OR (c.created_by = 1001)) |
| -> Seq Scan on tbl_unread_comments uc (cost=0.00..5205.35 rows=39853 width=9) |
| Filter: (remind_user_id = 1001) |
| -> Hash (cost=6936.06..6936.06 rows=34564 width=16) |
| -> Seq Scan on tbl_comments c (cost=0.00..6936.06 rows=34564 width=16) |
| Filter: (NOT is_system) |