PgBouncer

From PostgreSQL wiki

(Difference between revisions)
Jump to: navigation, search
(Update few links, add win32 compiles)
(Mention PgApt, few cleanups)
 
Line 33: Line 33:
 
* Official releases, bugtracker: http://pgfoundry.org/projects/pgbouncer
 
* Official releases, bugtracker: http://pgfoundry.org/projects/pgbouncer
 
* GIT: git://git.postgresql.org/git/pgbouncer.git ([http://git.postgresql.org/gitweb?p=pgbouncer.git;a=summary GitWeb]) ([https://github.com/markokr/pgbouncer-dev.git github])
 
* GIT: git://git.postgresql.org/git/pgbouncer.git ([http://git.postgresql.org/gitweb?p=pgbouncer.git;a=summary GitWeb]) ([https://github.com/markokr/pgbouncer-dev.git github])
 
'''Binary packages'''
 
 
* RPM: http://yum.postgresql.org/
 
* Win32:
 
** Hiroshi Saito's: http://winpg.jp/~saito/pgbouncer/ (has experimental win64 builds)
 
** Marko Kreen's: http://pgbouncer.projects.postgresql.org/win32/ (linux-mingw32 test-compiles, untested on real Windows...)
 
  
 
'''Distributor packages'''
 
'''Distributor packages'''
Line 45: Line 38:
 
Various OS distributions have their native package/port of PgBouncer.
 
Various OS distributions have their native package/port of PgBouncer.
 
So it might be good to first check if it is already available on your OS.
 
So it might be good to first check if it is already available on your OS.
 +
 +
'''Binary packages'''
 +
 +
Dedicated builds, might have newer versions than available at distributor repos.
 +
 +
* RPM: http://yum.postgresql.org/
 +
* DEB: http://apt.postgresql.org/ (Instructions here: [[Apt]])
 +
* Win32:
 +
** Hiroshi Saito's: http://winpg.jp/~saito/pgbouncer/ (has also experimental win64 builds)
 +
** Marko Kreen's: http://pgbouncer.projects.postgresql.org/win32/ (built with mingw32 on Linux, untested on real Windows...)
  
 
== Community support ==
 
== Community support ==

Latest revision as of 22:10, 11 December 2012

Contents

[edit] Project Overview

PgBouncer is a lightweight connection pooler for PostgreSQL.

[edit] Project Status

Stable, in production.

[edit] Features

  • Several levels of brutality when rotating connections:
    Session pooling
    Most polite method. When client connects, a server connection will be assigned to it for the whole duration it stays connected. When client disconnects, the server connection will be put back into pool. This mode supports all PostgeSQL features.
    Transaction pooling
    Server connection is assigned to client only during a transaction. When PgBouncer notices that transaction is over, the server will be put back into pool.
    This mode breaks few session-based features of PostgreSQL. You can use it only when application cooperates by not using features that break. See the table below for incompatible features.
    Statement pooling
    Most aggressive method. This is transaction pooling with a twist - multi-statement transactions are disallowed. This is meant to enforce "autocommit" mode on client, mostly targeted for PL/Proxy.
  • Low memory requirements (2k per connection by default). This is due to the fact that PgBouncer does not need to see full packet at once.
  • It is not tied to one backend server, the destination databases can reside on different hosts.
  • Supports online reconfiguration for most of the settings.
  • Supports online restart/upgrade without dropping client connections.
  • Supports protocol V3 only, so backend version must be >= 7.4.

[edit] Documentation

[edit] Downloads

Distributor packages

Various OS distributions have their native package/port of PgBouncer. So it might be good to first check if it is already available on your OS.

Binary packages

Dedicated builds, might have newer versions than available at distributor repos.

[edit] Community support

[edit] Feature matrix for pooling modes

Following table list various PostgreSQL features and whether they are compatible with PgBouncer pooling modes. Note that 'transaction' pooling breaks client expectations of server by design and can be used only if application cooperates by not using non-working features.

Supported PostgreSQL features.
Feature Session pooling [1] Transaction pooling
Startup parameters [2] Yes Yes
SET/RESET Yes No
LISTEN/NOTIFY Yes No
WITHOUT HOLD CURSOR Yes Yes
WITH HOLD CURSOR Yes No
Protocol-level prepared plans Yes No [3]
PREPARE / DEALLOCATE Yes No
ON COMMIT DROP temp tables Yes Yes
PRESERVE/DELETE ROWS temp tables Yes No
Cached plan reset Yes Yes [1]
LOAD statement Yes No
UDFs with session state Yes No
  • [1] - Full transparency requires PostgreSQL 8.3 and PgBouncer 1.1+ with server_reset_query = DISCARD ALL
  • [2] - Startup parameters are: client_encoding, datestyle, timezone, standard_conforming_strings and application_name. PgBouncer can detect their changes so it can guarantee they remain consistent for client. Available from PgBouncer 1.1.
  • [3] - It is possible to add support for that into PgBouncer.
Personal tools