How to enter rate limiting from a given user ID?

Edit: Title should be how to CREATE*

I want to set up some type of rate limiting feature on my database where a user with a given ID can only insert X amount of rows per hour (30 min?) let's say.

Is there something in postgres I can tap into to achieve this? I want to prevent bad actors from destroying my database in production.
Was this page helpful?