SELECT
    site,
    date,
    is_read,
    title,
    uid,
    name
FROM
    post p
    JOIN feed f ON p.site = f.slug
WHERE
    ($1::text IS NULL OR site = $1)
    AND (
        NOT $2
        OR NOT is_read
    )
ORDER BY
    date DESC,
    title OFFSET $3
LIMIT
    $4
