]> granicus.if.org Git - pgbouncer/commitdiff
Improve defaults: Set server_reset_query to DISCARD ALL
authorMarko Kreen <markokr@gmail.com>
Mon, 28 Mar 2011 05:26:56 +0000 (08:26 +0300)
committerMarko Kreen <markokr@gmail.com>
Mon, 28 Mar 2011 05:26:56 +0000 (08:26 +0300)
Now pgbouncer should be transparent with default config.

etc/pgbouncer.ini
src/main.c

index e3c452d3250f9ae5a62f1d3e1ca492a84212d8aa..176a70b70a9f391f85ac26507b1bd6ee8d96597d 100644 (file)
@@ -10,7 +10,7 @@
 foodb =
 
 ; redirect bardb to bazdb on localhost
-bardb = host=127.0.0.1 dbname=bazdb
+bardb = host=localhost dbname=bazdb
 
 ; acceess to dest database will go with single user
 forcedb = host=127.0.0.1 port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO connect_query='SELECT 1'
@@ -37,8 +37,10 @@ pidfile = pgbouncer.pid
 ; ip address or * which means all ip-s
 listen_addr = 127.0.0.1
 listen_port = 6432
-; unix socket is also used for -R
-unix_socket_dir = /tmp
+
+; unix socket is also used for -R.
+; On debian it should be /var/run/postgresql
+;unix_socket_dir = /tmp
 
 ;;;
 ;;; Authentication settings
@@ -71,6 +73,8 @@ pool_mode = session
 
 ;
 ; Query for cleaning connection immidiately after releasing from client.
+; No need to put ROLLBACK here, pgbouncer does not reuse connections
+; where transaction is left open.
 ;
 ; Query for 8.3+:
 ;   DISCARD ALL;
@@ -78,7 +82,9 @@ pool_mode = session
 ; Older versions:
 ;   RESET ALL; SET SESSION AUTHORIZATION DEFAULT
 ;
-server_reset_query = 
+; Empty if transaction pooling is in use.
+;
+server_reset_query = DISCARD ALL
 
 ;
 ; Comma-separated list of parameters to ignore when given
@@ -91,11 +97,11 @@ server_reset_query =
 ; When taking idle server into use, this query is ran first.
 ;   SELECT 1
 ;
-server_check_query = select 1
+;server_check_query = select 1
 
 ; If server was used more recently that this many seconds ago,
 ; skip the check query.  Value 0 may or may not run in immidiately.
-server_check_delay = 10
+;server_check_delay = 30
 
 ;;;
 ;;; Connection limits
@@ -103,6 +109,10 @@ server_check_delay = 10
 
 ; total number of clients that can connect
 max_client_conn = 100
+
+; defalt pool size.  20 is good number when transaction pooling
+; is in use, in session pooling it needs to be the number of
+; max clients you want to handle at any moment
 default_pool_size = 20
 
 ; how many additional connection to allow in case of trouble
@@ -111,11 +121,14 @@ default_pool_size = 20
 ; if a clients needs to wait more than this many seconds, use reserve pool
 ;reserve_pool_timeout = 3
 
-log_connections = 1
-log_disconnections = 1
+; log if client connects or server connection is made
+;log_connections = 1
+
+; log if and why connection was closed
+;log_disconnections = 1
 
 ; log error messages pooler sends to clients
-log_pooler_errors = 1
+;log_pooler_errors = 1
 
 
 ; If off, then server connections are reused in LIFO manner
index b7597a73762ee16e372fad9a9b0093c5c2bc867f..a372e434610ba49339b2f3ed9cee02a650abf952 100644 (file)
@@ -181,7 +181,7 @@ CF_ABS("user", CF_STR, cf_username, CF_NO_RELOAD, NULL),
 
 CF_ABS("autodb_idle_timeout", CF_TIME_USEC, cf_autodb_idle_timeout, 0, "3600"),
 
-CF_ABS("server_reset_query", CF_STR, cf_server_reset_query, 0, ""),
+CF_ABS("server_reset_query", CF_STR, cf_server_reset_query, 0, "DISCARD ALL"),
 CF_ABS("server_check_query", CF_STR, cf_server_check_query, 0, "select 1"),
 CF_ABS("server_check_delay", CF_TIME_USEC, cf_server_check_delay, 0, "30"),
 CF_ABS("query_timeout", CF_TIME_USEC, cf_query_timeout, 0, "0"),