https://github.com/remind101/activerecord-pgbouncer
ActiveRecord connection adapter for using PgBouncer safely.
https://github.com/remind101/activerecord-pgbouncer
Last synced: over 1 year ago
JSON representation
ActiveRecord connection adapter for using PgBouncer safely.
- Host: GitHub
- URL: https://github.com/remind101/activerecord-pgbouncer
- Owner: remind101
- License: bsd-2-clause
- Created: 2016-06-16T01:59:50.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-16T02:27:28.000Z (about 10 years ago)
- Last Synced: 2025-04-20T13:19:45.741Z (over 1 year ago)
- Language: Ruby
- Size: 9.77 KB
- Stars: 2
- Watchers: 15
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ActiveRecord PgBouncer Connection Adapter [](https://travis-ci.org/remind101/activerecord-pgbouncer)
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:
```ruby
gem 'activerecord-pgbouncer'
```
## Usage
This adds a `pgbouncer` adapter, which you can use in `config/database.yml` or `ENV['DATABASE_URL']`:
```yaml
production:
adapter: pgbouncer
pooling_mode: transaction # Can be `session`, `transaction`, or `statement`
```
```shell
export DATABASE_URL=pgbouncer://user:pass@host/db?pooling_mode=transaction
```