Home > Software design >  How to limit max return rows of PostGRest?
How to limit max return rows of PostGRest?

Time:06-11

I'm running a Postgrest api on a database with roughly 30 million rows. Sometimes I accidentally query the whole table without a ?limit parameter, and it severely lags the server. I also plan on making this public, and I do not want other users to do this as well. Is there any way to limit the maximum number of rows Postgrest returns? I know its possible because I have seen other Postgrest api's do it.

I'm using Nginx, and the latest Postgrest docker release.

CodePudding user response:

You can use the db-max-rows config:

https://postgrest.org/en/stable/configuration.html#db-max-rows

  • Related