public inbox for [email protected]  
help / color / mirror / Atom feed
From: Jeff Janes <[email protected]>
To: Laurenz Albe <[email protected]>
Cc: richard coleman <[email protected]>
Cc: Pgsql-admin <[email protected]>
Subject: Re: analyze foreign tables
Date: Fri, 4 Aug 2023 10:48:00 -0400
Message-ID: <CAMkU=1yu3C1bMHBoMovVMbMZ_WLnh3sdh7WxUcwUbiBWGvPsbQ@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAGA3vBt726ha1P91DrSOF8oc57X27tLO8o9Wi9oDN5L3qqRi7Q@mail.gmail.com>
	<[email protected]>

On Thu, Aug 3, 2023 at 8:37 AM Laurenz Albe <[email protected]>
wrote:

> On Tue, 2023-08-01 at 09:47 -0400, richard coleman wrote:
> > In PostgreSQL foreign tables are not automatically analyzed and analyze
> must be
> > specifically called on each table.  In the case of sharing tables
> between PostgreSQL
> > clusters, there is the use_remote_estimate foreign server option.
> >
> > In some of our multi terabyte databases, manually running analyze on all
> of the
> > foreign tables can take more than a day.  This is per database
> containing the
> > foreign schema.  Since we have certain large schema that we have
> centrally 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
> the foreign
> server, and the default value "auto" should be just what you need.
>
>
In addition to this new feature, analyzing foreign tables can also be
highly dependent on an old feature, fetch_size.  The default fetch_size is
really quite small and might be a bottleneck for ANALYZE.

Cheers,

Jeff


view thread (15+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: analyze foreign tables
  In-Reply-To: <CAMkU=1yu3C1bMHBoMovVMbMZ_WLnh3sdh7WxUcwUbiBWGvPsbQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox