Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wB6Jd-000jfp-1R for pgsql-general@arkaria.postgresql.org; Fri, 10 Apr 2026 07:30:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wB6Ib-00ACW5-1c for pgsql-general@arkaria.postgresql.org; Fri, 10 Apr 2026 07:29:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wB6Ib-00ACVw-0Q for pgsql-general@lists.postgresql.org; Fri, 10 Apr 2026 07:29:06 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wB6IZ-00000000IET-2iPe for pgsql-general@postgresql.org; Fri, 10 Apr 2026 07:29:04 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-488ab2db91aso24999205e9.3 for ; Fri, 10 Apr 2026 00:29:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1775806142; x=1776410942; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=WJ4xifdeAiBtPGE09S/Wh1lYhgBKFAgHsRlBd8UXqps=; b=FgbGK+uRnlsmf2RPb1llLJuA1a7Pf5Y5VtKBmNH7DKHlHy4G8+GTx4oGfvPE5BJebn 6f2wkVmdoJ8axjFf5++lu6mvkOge617F7+K8XJe5EL8CWjOv9hBMY3HSj1PQiM+oRNT3 BjoI87KKnsNDb6kpUEQUMtb/H/e0LFlAhjsEvdaezFjfqUdTLDhBpPd+cLGweqbKywEG 2dFjw2yoeRwf2GcsGZ3p65epe03X2XrkYYmHJTgSFmoU4nX9PuvzKVfahPnSuam/YWZc jCPP0DPUpGftdn0ym1k0/HpUELlzDnPstqvL2bzIxNQGCmhaqA1D+HW8McYJDoXedKnJ siHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775806142; x=1776410942; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WJ4xifdeAiBtPGE09S/Wh1lYhgBKFAgHsRlBd8UXqps=; b=q+WpTmzutoDfwr9JSDx2Vl1OB/YuXqX513+4C/GNUUWJCI1xikWk0FyunJfM1u281h RE0xbHOWyuklCLyJKnZerw1rD+TrpSv+j+NMwbhovCFcOEIzZLBno76ERTB6+WBbz1ow d/nzG5S8mpw04CJCBYGFdHL66r97PGFpkFk4ZGwOd5JSe06m2K0JsYaZjjouBzcTaDqP 7ZOon8CCWuw3q0kYLhvavCgTuAHZh2t42h7au0dlHhrs9aKgKttUQ4GYGxLkCGUCQ7MZ xCiFS+zgDY28u75ZEBAnWVuPCGdG13wCRC/B2u5cfeHeq2N8/05YrgJ13O84GFCk/NjE Yusw== X-Gm-Message-State: AOJu0YwEbOtL8N36qAYNREQJmhws1xttz1NiJrsmosW2wZOYOcOwPg7S fjXHHsMuuKfDe54qvManjIQ3shWbLJUkWTw+xkqJvLp9TL+xC3zlWG0BJML1fkvo0d8= X-Gm-Gg: AeBDietp4nYeC/Hi6mCaqUTf4a+opQtEwQWkdCl8SlvbXoruaWl6iPwTdrpmDs38+dr SWwCUH/ZEDOeZOgOnRwIwaGTLddrpoU1exzrZ4C42xsXYEbxjCWwHFFZQm5GMLoZBrr0nDHrqLZ 2X6l0E2Zw08UhO41NKouTLQPwtNmrbuzDMQI96IWfK7mR+GGV253W7Dq+/jq0KDC/A0b1tRbSqm HlIPlU4uV6ZNXzQvXFSjp2n3XC26SXt+Bn0PSrAxm/vYkh15O41Bjv6K6idZFy5D8jLrsfL5Z8J QpFEwWz/6uMBfx4uLFJfmUXn5faQUALnIHs/FluFMjS+GTn5saD8YPXjhGqtiS8WnW5ttDWRbT5 8ohjCDL+jDIgWpRWVK2NGggAGjEHWNBpElOCGC7QcQZQU8aamrlQgUZKlI6SJuatSZogjfIDmY+ sFhyGYupZQLcynnt+57mk+Ti1LuiMfMw3245TIRUjJpRh9wpm9EZ8U X-Received: by 2002:a05:6000:604:b0:43c:fbcd:4b4f with SMTP id ffacd0b85a97d-43d642f01b7mr2995029f8f.47.1775806142439; Fri, 10 Apr 2026 00:29:02 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:3694:818b:8375:7a72:260b]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d63e50200sm5346532f8f.29.2026.04.10.00.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 00:29:02 -0700 (PDT) Message-ID: <2bdca9488627c8a0e855f00d7a1137cfdd01746e.camel@cybertec.at> Subject: Re: Pgbouncer and Node JS application Query read timeout error From: Laurenz Albe To: KK CHN Cc: pgsql-general Date: Fri, 10 Apr 2026 09:29:01 +0200 In-Reply-To: References: <6b3cf69fa569d263a593cc2afe74dc35d29754eb.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2026-04-10 at 12:37 +0530, KK CHN wrote: > > The only way I can imagine that pgBouncer is leading to timeouts on the= client side > > is if client sessions are waiting, because all connections are in use. > >=20 > > You can run SHOW POOLS in the pgBouncer console to see if there are any= "cl_waiting". > > If that is the case, you should configure the Node.js pools smaller, so= that no > > connection has to wait. >=20 > Configuring Node.js=C2=A0 pools smaller ?=C2=A0 I couldn't get the=C2=A0 = logic here=C2=A0 why advised to reduce the pool size ?=C2=A0 > =C2=A0 > Increasing pool size=C2=A0 more than 10 adversely=C2=A0affects the connec= tion=C2=A0 establishment from > Node.js=C2=A0 application=C2=A0?=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Since = DB=C2=A0 is having=C2=A0 =C2=A0Pgbouncer infront=C2=A0and > default_pool_size =3D 50 there ,=C2=A0 don't we have the freedom to incre= ase node.js application > pool size and it will help the query timeout ?=C2=A0 =C2=A0or any hidden = facts involved could you elaborate .. There are no hidden facts. You asked if pgBouncer could lead to query timeouts. I answered that the o= nly way a query could take significantly longer with pgBouncer is if the client has to wait= for a pooled connections, that is, if the connection pool in pgBouncer is smaller than t= he number of clients that want to run a transaction concurrently. BEFORE you take any action, you should figure out if that is the case by lo= oking at SHOW POOLS. Since you didn't report any findings, I assume that you lau= nched your volley of questions before doing the required investigation. Bad idea. IF (and only if) there are indeed client sessions waiting for a pooled conn= ection, you could react in two different ways: - increase the pgBouncer pool size - reduce the application server pool size Obvious, isn't it? Increasing the pgBouncer pool size is a good idea only if your database mac= hine can stomach the additional load. If not, reducing the application server pool = size is the correct measure. If the application load is too much for the database,= somebody has to suffer. If you choose to overload the database, everybody will be u= nhappy. If you throttle the load in the connection pool, only some client will be u= nhappy (those that have to wait and get a timeout). You will have to diagnose what the exact problem is. Yours, Laurenz Albe