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.94.2) (envelope-from ) id 1qRXZu-0027iC-1z for pgsql-admin@arkaria.postgresql.org; Thu, 03 Aug 2023 12:37:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qRXZs-00DEiK-8h for pgsql-admin@arkaria.postgresql.org; Thu, 03 Aug 2023 12:37:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRXZr-00DEiB-Ov for pgsql-admin@lists.postgresql.org; Thu, 03 Aug 2023 12:37:16 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qRXZp-000KcA-J7 for pgsql-admin@lists.postgresql.org; Thu, 03 Aug 2023 12:37:15 +0000 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-99c4923195dso128982166b.2 for ; Thu, 03 Aug 2023 05:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1691066233; x=1691671033; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=UE4QFDm2B69PYGc5yL1A+IxVuDB0kse6Sp9cJC+QlSs=; b=lsgrIVdJAI39LfaXTy+P9Lpcu4yNXcBpX0Cgpo9tMKEbmmNlcGGqOvwmWDKA/OiOiq 3x8lS0NT9fh+xqgUMO4+xM+sefJkIR9tEo4PEaqrtuq1xAkU3aWW4IFEQGRgYCeXDrqQ bF7vpC1fOXDeW7z7cFE+WISp6PNnfHmqwKYvvPmxv2oAZ5nvp6rfR82DvCNMZunlcRL8 CC5tOtrdu+tfsrx51XLXQGrPpnJaXrAPXZrFlovWaEM9p9Ze6TYjMakG7CcZ4wlEWejB Cs+K1oPw8jcBqijrbKmENVVTjbb+eO7apXdqm+vM4EZwUcors6TgGrHzGMosyBs9QQXm KWTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691066233; x=1691671033; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UE4QFDm2B69PYGc5yL1A+IxVuDB0kse6Sp9cJC+QlSs=; b=j657Ukh3cPnqkNgMTaM9tyyJpfDAilZ+CT911m/UVI9yTSay/CNcK//Y5yrBZ4tTVj 56sQjTjvmAdL21ZozW5CVqKmCLeFVNB0Zx4I2Abj0MqyL0guBN5IH6wDJSRQInhQG7aO 7THogsxWT/p3QxkTpH02H+O5XmIMgZNMJO2nGJk1annCfY5BC/ZcodKQmdLWH8Ow+8fv Pcp+n3K4lgkOZwKG0X3ZYzWZ0VLZ1wy4osgGmg1pGOjkU6jFbVDjIHCI1JxcA21pL7Nj RqJ9vu3wQHUxRHCJeCq5pakCsm7mX042Vr6XK7VtSo/39mCDfpNHnRpinjyQQ0Im5HVH M3jA== X-Gm-Message-State: ABy/qLb6fZvWiRt7bIV9HDObGG3qGctaC8bxVV1COMbvGIl0ClBbtKaC MpE9EqJoxsj62UDGfA02PuAFoA== X-Google-Smtp-Source: APBJJlGeFoou0104Fx/8Sex29srjZh6YsxlnBPIyT0ZTLarjVSQIZPZI2qKCjj+zBkJMuSy9Jpihfw== X-Received: by 2002:a17:906:3088:b0:99c:50ee:3da9 with SMTP id 8-20020a170906308800b0099c50ee3da9mr3121846ejv.45.1691066232732; Thu, 03 Aug 2023 05:37:12 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:6acd:7737:df67:614a:2637]) by smtp.gmail.com with ESMTPSA id f25-20020a170906085900b00991d54db2acsm10418731ejd.44.2023.08.03.05.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 05:37:12 -0700 (PDT) Message-ID: <615ccd4a1de716c229cf125260896051b1989608.camel@cybertec.at> Subject: Re: analyze foreign tables From: Laurenz Albe To: richard coleman , Pgsql-admin Date: Thu, 03 Aug 2023 14:37:11 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 2023-08-01 at 09:47 -0400, richard coleman wrote: > In PostgreSQL foreign tables are not automatically analyzed and analyze m= ust be > specifically called on each table.=C2=A0 In the case of sharing tables be= tween PostgreSQL > clusters, there is the=C2=A0use_remote_estimate foreign server option. >=20 > In some of our multi terabyte databases, manually running analyze on all = of the > foreign tables can take more than a day.=C2=A0 This is per database conta= ining the > foreign schema.=C2=A0 Since we have certain large schema that we have cen= trally located > and share to all of our other database clusters, this really adds up. I just saw that PostgreSQL v16 uses remote sampling for ANALYZE on foreign = tables. This is governed by the option "analyze_sampling" on the foreign table or t= he foreign server, and the default value "auto" should be just what you need. Yours, Laurenz Albe