It occurs to me that this is very similar to the method I proposed in
June to enforce a hard limit on WAL usage, to avoid PANIC caused by
running out of disk space when writing WAL:
http://www.postgresql.org/message-id/51B095FE.6050106@vmware.com
Enforcing a global limit needs more book-keeping than rate limiting
individual sesssions. But I'm hoping that the CHECK_WAL_BUDGET() calls
could be used for both purposes.
- Heikki