High Performance PostgreSQL for Rails: Using Advisory Locks (page 195)

@andatki

In this page, you mention:
The Transaction Pooling Mode for PgBouncer cannot be used with Advisory Locks
Can you expand a title further on this? PgBouncer is like a first resource when people run out of database connections, and now that it supports prepared statements people are much more inclined to continue to use it.
With the increase awareness of advisory locks and things like GoodJob background job processing, are we increasing the risk of problems?

In the table for features for PGBouncer we can find some information: PgBouncer features

Do you think that having a more detailed explanation on the risks and what we should do to ensure to remain compatible (using session pooling, basically)

Even after reading the Choosing A PgBouncer Pooling Mode in page 190 and when using GoodJob, being the transaction mode, the most common, the user can easily fall in the trap of choosing the most common method to later release it’s not supported.

1 Like

Thanks @fidalgo. That’s a good idea to point out that possible surprise. As you noted, we can now use Prepared Statements with PgBouncer in the transaction pooling mode. But other “client features” aren’t supported, also as you noted, leaving only session mode which has less benefits. I agree it would nice to provide some warning and caution about that. I’ll follow up if I can get something included in time. Thank you!