- why doesn't Postgres use the composite index, and then retrieve only the minimum necessary amount of rows (50 per user) using the query I posted above?
But your query does not list the first 50 rows per user. It only returns the first 50 rows of:
SELECT"orders".*
FROM"orders"
WHERE (user_id IN ?, ?, ?)
ORDERBY"orders"."created_at"
Who knows which users are going to be in that list???