From: Marko Kreen Date: Mon, 28 Mar 2011 05:26:56 +0000 (+0300) Subject: Improve defaults: Set server_reset_query to DISCARD ALL X-Git-Tag: pgbouncer_1_4_1_rc5~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30032a9f8431a7abaea6d2c325690a0470c6807d;p=pgbouncer Improve defaults: Set server_reset_query to DISCARD ALL Now pgbouncer should be transparent with default config. --- diff --git a/etc/pgbouncer.ini b/etc/pgbouncer.ini index e3c452d..176a70b 100644 --- a/etc/pgbouncer.ini +++ b/etc/pgbouncer.ini @@ -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 diff --git a/src/main.c b/src/main.c index b7597a7..a372e43 100644 --- a/src/main.c +++ b/src/main.c @@ -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"),