Open steve-chavez opened 2 weeks ago
We should be very careful here. ROWS
does influence the planner. You want my_func
to possibly return 100_000 rows, but the planner assumes this function will return that many rows. If you return only a handful of rows, you might get a different plan, which is muss less efficient, because it assumes you will return many rows.
Problem
https://postgrest.org/en/v12/references/configuration.html#db-max-rows is enforced for all endpoints, even for RPC.
RPC already offers escape hatches with function settings, but not for this.
Solution
Use the function
ROWS
setting as a way to surpassdb-max-rows
. Having adb-max-rows=1000
, this:Would surpass the
1000
global limit for/rpc/my_fun
.Note: we already use
ROWS
for https://postgrest.org/en/v12/references/api/resource_embedding.html#computed-relationships