No commit activity in last 3 years
No release in over 3 years
ActiveRecord connection adapter for safe PgBouncer use
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
>= 0

Runtime

<= 5, >= 4.1
 Project Readme

ActiveRecord PgBouncer Connection Adapter Build Status

When using PgBouncer, there are certain considerations to take into account:

  • If you're using transaction pooling mode, prepared statements must be disabled.
  • If you're using transaction pooling mode, session level features should not be used.

This is a light layer above the PostgreSQL connection adapter, that helps ensure that you don't make the mistakes above!

Installation

Add this line to your application's Gemfile:

gem 'activerecord-pgbouncer'

Usage

This adds a pgbouncer adapter, which you can use in config/database.yml or ENV['DATABASE_URL']:

production:
  adapter: pgbouncer
  pooling_mode: transaction # Can be `session`, `transaction`, or `statement`
export DATABASE_URL=pgbouncer://user:pass@host/db?pooling_mode=transaction