Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Iwk-0008IK-5Y for pgsql-general@arkaria.postgresql.org; Tue, 11 Aug 2020 01:19:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k5Iwi-0007to-P4 for pgsql-general@arkaria.postgresql.org; Tue, 11 Aug 2020 01:19:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Iwi-0007tf-H8 for pgsql-general@lists.postgresql.org; Tue, 11 Aug 2020 01:19:20 +0000 Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k5Iwe-0007xM-0R for pgsql-general@lists.postgresql.org; Tue, 11 Aug 2020 01:19:19 +0000 Received: by mail-pj1-x1041.google.com with SMTP id d4so980100pjx.5 for ; Mon, 10 Aug 2020 18:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=9L6tmnjKbPgMJ/uk+whI0EztzV1xXAphdME+/vHuEAo=; b=n7Wb70GOlIYfUpo355fALJBp3OoZFRyPddNr/TVoZU7YG3qIIKCIi2eeihjLZbSYRJ YFNWV7GIsXsD+C3xEP8rJVZsTTmTGMmpQvmN6gDxcMoLRzXBZIQ5tsgRVJGJgsHblnzf ZpzeoDjW7+HP1xMJ6bibHsP0MtqWpoBXh9/iDaSWzmL/BaSCP53gc2yHS5bPOtbf7YCo iiSR6qD5FaRCoSIAm8MPZFwHGRYB/ARZ2wxfdd64F/foHWctPYC0y2p1tsWYqEUM7hiY +ux38Hfj4vFJxj1E3oUMS8aS2b15WkEbFDnA0tyhl0oE03m4Dqy1wREjEgyxwjjDTN8f JEuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=9L6tmnjKbPgMJ/uk+whI0EztzV1xXAphdME+/vHuEAo=; b=VFt1y17uueJji4tSRHWUAKKBCAvH5n7rUZlkrOX11MbI0vc1+768HUMtIKXv6Lu88W 3eP9iFFWIfaWJHDpPru9Mr2ucBcYSY93iQblAqnOc3aItzmav5WcD3ex6duo7j42cEDT Bgib4Co0QabHcWpCENZCyeKdCYx4mR5SJ+x9q2vxwt7Jsyxpnd8bnw6WXbVDIrwJ+bsH qPSTlBKVpdNjn6hY/1JVCXbM2t+1wSwbwQFXG4n6ICGREwethSOQU5fxrTkaGo5gHPEF C0uQ4JhKMl4z3EYV9ZAcK2WmV+zkqbuTxo/KmhTxVd41iSv5KSM5RedJmFV4Rzu1r9mr JFEg== X-Gm-Message-State: AOAM533apfafc+Q9EkDOAJzSaGwJrQ05E2jXPMW3l1A6eQDzw/co5LrD h9GCx6IQHWaqjSnX/KsohZVjQjdsRPMv+FA+MpbqUUe0DLhyM+kcBEUyujYk8KnKCQyAc6PZ3OK 1lyWLbkmlH7W5h7hfK9Zex7yW7R6lpS77o4vQbGM/zMFHofIakvn4nCfdbZ9zUTZMShSq5TDfl6 Z8sw1R452on1n+aZOPZ9eQ X-Google-Smtp-Source: ABdhPJxwiSx8iBUg3YXxMOfwVER2K/L0MVZtqkMBdMOTfnFWcOt5y8PuNJTR0M+OVSMoEmht0OJcTw== X-Received: by 2002:a17:90a:ad4c:: with SMTP id w12mr1960556pjv.129.1597108753108; Mon, 10 Aug 2020 18:19:13 -0700 (PDT) Received: from osaka.octopusnet (p1382088-ipngn14901marunouchi.tokyo.ocn.ne.jp. [153.206.35.88]) by smtp.gmail.com with ESMTPSA id 132sm13853923pgg.83.2020.08.10.18.19.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2020 18:19:12 -0700 (PDT) Subject: Re: Keeping state in a foreign data wrapper To: pgsql-general@lists.postgresql.org References: <483E8B68-D9DB-4533-BA82-206F41E53626@gmail.com> <113D4B17-B9EA-425A-896C-0095C73FDF8C@gmail.com> From: Ian Barwick Message-ID: <0fa7c591-6ea2-ab84-0665-62c64cb90785@2ndquadrant.com> Date: Tue, 11 Aug 2020 10:19:10 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <113D4B17-B9EA-425A-896C-0095C73FDF8C@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/08/04 19:21, Stelios Sfakianakis wrote: > Thank you again, I have another question in order to make sure I have a clear understanding: > > >> On 4 Aug 2020, at 11:24, Ian Lawrence Barwick wrote: >> >> The hash table is specific to each running backend so will only be >> accessed by that process. >> >> Pre-loading a shared library just gives the library an opportunity to >> set up shared memory etc. You can always try adding one of the FDW >> libraries to "shared_preload_libraries" and see what happens >> (theoretically nothing). >> > > My impression was that since each client (e.g. libpq) connection results in the creation of a Postgres process in the backend (https://www.postgresql.org/developer/backend/) then this (mysql) "connection pool" hash table is not global per se and shared among the different client / users sessions. Correct, the connections are specific to each individual backend. > But that defeats the purpose, no? The purpose is to cache connections within the session, to avoid the overhead of reconnecting to the remote server each time a query for that server is issued in that session. Regards Ian Barwick -- Ian Barwick https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services