Get top two rows per group efficiently
You can use ROW_NUMBER window function to set an order, then simply use it as a subquery with a proper predicate.
SELECT FROM
(
  Subquery
)
WHERE 
    post_num &lt;= 2;



SELECT
    title,
    author,
    created_at,
    ROW_NUMBER() OVER (PARTITION BY author ORDER BY created_at) as post_num
FROM
    posts


title             | author | created_at | post_num
:---------------- | :----- | :--------- | -------:
Johns first post  | John   | 2021-01-01 |        1
Johns second post | John   | 2021-01-02 |        2
Johns third post  | John   | 2021-01-03 |        3
Mikes first post  | Mike   | 2021-01-01 |        1
Mikes second post | Mike   | 2021-01-02 |        2
Mikes third post  | Mike   | 2021-01-03 |        3


db&lt;&gt;fiddle here