Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass db-max-rows for RPC #3576

Open
steve-chavez opened this issue Jun 7, 2024 · 1 comment
Open

Bypass db-max-rows for RPC #3576

steve-chavez opened this issue Jun 7, 2024 · 1 comment
Labels
idea Needs of discussion to become an enhancement, not ready for implementation

Comments

@steve-chavez
Copy link
Member

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 surpass db-max-rows. Having a db-max-rows=1000, this:

CREATE FUNCTION my_func() RETURNS SETOF projects ROWS 100_000

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

@steve-chavez steve-chavez added the idea Needs of discussion to become an enhancement, not ready for implementation label Jun 7, 2024
@wolfgangwalther
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Needs of discussion to become an enhancement, not ready for implementation
Development

No branches or pull requests

2 participants