Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gug2D-0007c9-Sp for pgsql-general@arkaria.postgresql.org; Fri, 15 Feb 2019 16:08:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gug2C-0005je-6c for pgsql-general@arkaria.postgresql.org; Fri, 15 Feb 2019 16:08:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gug2B-0005jX-RQ for pgsql-general@lists.postgresql.org; Fri, 15 Feb 2019 16:08:15 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gug28-0004BV-PU for pgsql-general@lists.postgresql.org; Fri, 15 Feb 2019 16:08:14 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id C96522234C for ; Fri, 15 Feb 2019 11:08:11 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 15 Feb 2019 11:08:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=p NG412Y9HPBv2THVcJ7oxoB1lNI0rDv9guxiI4r2NpU=; b=kCbCmCxujmi426fbT 8olIoeYmj/MQ0YSbUPI7AXGooNyx40gXqQp0GMMPlpVyXqvPPLno3xPREkvf4hdn rb7nzOylIMiSwbgvCxuUr3eO36gd4AzmNVP4pLkBGKDyKSTBoNz1ExjfW7WamFck /ENxtHlkKthNIexYfOpF4r/FcJC+S1avYurIiYZ4IgUGAT+Od32P4/QLxgSGU99t ttcRqLMDIp8+CAH4ZBBa5RsTDw+4MRjzJ2PCXdVZUjTwb10i2MwcPD8xE+mschtQ lCkQtXPdzK8SC+0rD7ctVCgTFEZvxdK1fy7rAyyzQV2ee67Iv/XUA+dMB7PVOFZ6 UeYYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=pNG412Y9HPBv2THVcJ7oxoB1lNI0rDv9guxiI4r2N pU=; b=7xLJhmhMWLFly7r0hskbMFa9pBGWWyRS6+rE0Syf9pJ96tX3VYmg+jji4 EZ4Tsbr0/8CcNSTHgfWAtIRpGaw8Nyb0NUvOWTEUQTyBrdUEs9knonrsMrvIylrV paXbTLAuwHBd5Q3bfFqJAm6nYh/dYSS/WCGREpp5bp6cCCmLAmAIDhHOmLuYrysH 5RLX6yDyax6Jz3zIZ5cSksJrS+DVR97YDmpRA5zBdIKdiUtTCfux4p40DogdttyU t8La/CiwS1LeVHIBDC8YO0Okbyiry0muq9rdukKtt9oSw+k/a8U5fFYCgLWm9+DV ZqX3SuMbwc6tztNpKtI5RxwfTLmPg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledruddtjedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecuogfuuhhsphgvtghtffhomhgrihhnucdlgeelmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpe hgihhthhhusgdrihhopdhpghhpohholhdrnhgvthenucfkphepjedurddvuddvrdduhedt rddvtddvnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id BF8F6E409E for ; Fri, 15 Feb 2019 11:08:10 -0500 (EST) Subject: Re: How to setup only one connection for the whole event loop? To: pgsql-general@lists.postgresql.org References: <1639716788.536278.1550160364895.ref@mail.yahoo.com> <1639716788.536278.1550160364895@mail.yahoo.com> From: Adrian Klaver Message-ID: <6aaf55f2-145e-a395-b372-41cae0037f06@aklaver.com> Date: Fri, 15 Feb 2019 08:08:10 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <1639716788.536278.1550160364895@mail.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/14/19 8:06 AM, Dominic Gua�a wrote: > Dear all, > > I am new to postgresql and I am creating a c program that can receive > request from different users. I want to maximize the performance of > postgresql so I intend to just create 1 connection that would service > all queries of different users. How do I do this? Use one of the existing Postgres poolers?: http://www.pgpool.net/mediawiki/index.php/Main_Page http://pgbouncer.github.io/ > > Do I create a new connection each time there is a new request like how > it goes in MySQL or can I just have one connection that is established > in my `main` function? > > Sincerely -- Adrian Klaver adrian.klaver@aklaver.com