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 1k5Iwz-0008J0-Fo for pgsql-general@arkaria.postgresql.org; Tue, 11 Aug 2020 01:19:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k5Iwy-0002Se-Ea for pgsql-general@arkaria.postgresql.org; Tue, 11 Aug 2020 01:19:36 +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 1k5Iwy-0002SX-6t for pgsql-general@lists.postgresql.org; Tue, 11 Aug 2020 01:19:36 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k5Iwv-0007xd-Nf for pgsql-general@lists.postgresql.org; Tue, 11 Aug 2020 01:19:35 +0000 Received: by mail-pl1-x642.google.com with SMTP id t10so6006661plz.10 for ; Mon, 10 Aug 2020 18:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=li4BUCAk62Af7k8+V9UrKdu7vpcHfQ85R2u2nGC0gsQ=; b=XqQKygQTZoKdanahI2yZyf1PWL7AkR82c/rXOW01TveX1pfAe8tUdMRryAOnnpCoxI DHuDU1shOPR2Tls4eAO6GVwBfDApp9sCV5VaQtjBaYNjYypd/ACEGRxWINNqLTCynhVl +OAr25LnOM98B0YOeVK5yiGw/anblU0AsUc9TamGLNuJFjWsdZYwEto1b7GoUJ0xasEn YTKSXtrf0b8R2oQr+2ogXrmktRGVV5mgxrlJr2CC0Di12QTuREpiMl6IQmqQvEJYPZsS wTDfZP/RTDLHRL/A4uyV/Rycb5hNgg1xz3AKtyEyglpezVp4JaGFBMKHXNFNGYxmD076 aXWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=li4BUCAk62Af7k8+V9UrKdu7vpcHfQ85R2u2nGC0gsQ=; b=QGQUmo88cBBp3VeIBNShFxa23iXnbeGLHJ6Ca1nLR5+hlQUOPR9u1MuA8I8xzoQq9X i1vuOA2HT6rW9hyRgGcOAniAi22cIph5H450kviUGMPXsRZ4kaawtf3rpL9S8kyXp5tG cQnzTfag7VBKHQlBXqsfeEsPVXrD9buk3JWCcodNuIaTcWNynXabVjbNvpj91FzxXXG+ kBff0c9ivvxXk+T756qU2lFO5M9yqdQ7GWPH3xxRa/fH1RJNyOmlInHuP1Hm+MW5l4o/ BN42HcEvp1MGU6xWxCxGrDZmHy+j0yS2ruo7yTJV6WQiVE3d0p2/cbYTO9sRRanyXgHG jLmA== X-Gm-Message-State: AOAM532/XbY6+qarYn7vZ9mGjuE6VMrkzJpdAt1gx0tl36J+PpJ1m6of xVKy0N+LynMZ2wOVeqeDpCfP2QR3/tvD4nQXBKvgaDkfgeFBhw0ndAG7wLOdn/UOeRc669MZpkj Bfq40whwcXtv2GT7g8hoa7rDx1nfGKF0yG38QiPVE4PhYMY7UAklMA7zTm3trMpximHkwNiPfo0 2MulF0ZLmgRii/SZBSFEyn X-Google-Smtp-Source: ABdhPJwDrAyU8aLSlDYbNLmCr1GtUDv8kfKKTTmvZhFoNGV35lTOR6WFigPBGSHvxao4lDnHpqnGNA== X-Received: by 2002:a17:902:768a:: with SMTP id m10mr3609245pll.125.1597108771528; Mon, 10 Aug 2020 18:19:31 -0700 (PDT) Received: from osaka.octopusnet (p1382088-ipngn14901marunouchi.tokyo.ocn.ne.jp. [153.206.35.88]) by smtp.gmail.com with ESMTPSA id f18sm19209052pgv.84.2020.08.10.18.19.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2020 18:19:30 -0700 (PDT) Subject: Re: Keeping state in a foreign data wrapper To: Stelios Sfakianakis Cc: Ian Lawrence Barwick , 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: <074df913-4d7b-b392-6870-0bee49003f92@2ndquadrant.com> Date: Tue, 11 Aug 2020 10:19:28 +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