Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to Rate Limit or Throttle a user or a connection in PostgreSql?

Tags:

postgresql

We have a setup wherein a Database instance is shared between multiple users.

We are trying to implement some form or throttling or Rate limiting for a shared PostgreSQL so that one user may not starve other users from consuming all the resources.

One approach that we can think of is adding connections pools and fixing the number of connections that we give each tenant.

But one user can still starve all the resource over a few connections. Is there a way to throttle resource usage per connection or per user in PostgreSQL?

like image 212
Sameer Avatar asked Nov 23 '25 10:11

Sameer


1 Answers

No, the postgres documentation makes it clear that's not possible using Postgres alone.

It's usually a (very) bad sign if your application allows one user to starve resources from others - it suggests you've got a bottleneck in your application, and that bottleneck will appear when you least want it to.

like image 87
Neville Kuyt Avatar answered Nov 24 '25 22:11

Neville Kuyt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!