Для правильного вопроса надо знать половину ответа
WITH `cte` AS (
SELECT *, ROW_NUMBER() OVER `w` AS `row_num`
FROM `posts`
WINDOW `w` AS (
PARTITION BY `user_id`
ORDER BY `time` DESC
)
) SELECT *
FROM `cte`
JOIN `users` ON `users`.`id` = `cte`.`user_id`
WHERE `cte`.`row_num` <= 3