pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: timur.luchkin@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15506: Foreign data wrapper (postgres_fdw) unexpected behavior
Date: Wed, 14 Nov 2018 10:18:42 -0500
Message-ID: <7371.1542208722@sss.pgh.pa.us> (raw)
In-Reply-To: <15506-9c8798a2d6cd06b0@postgresql.org>
References: <15506-9c8798a2d6cd06b0@postgresql.org>

=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> When I trying to analyze the foreign table itself , - it takes all the
> incoming network traffic (400Mbit) and can't complete in 10 minutes (I can't
> wait more, because it affects production environment). 
> Why the analyze of the foreign table can't just take already collected
> statistics from the remote server? Is it a bug or some limitation?

This is not a bug; it's operating as designed.

The key reason not to do it as you suggest is that whatever stats the
remote server might have for its table don't necessarily apply to the
foreign table, because the foreign table is in effect a view of the
remote table --- it could, for example, have different column types
necessitating different stats.  Or the remote server could be a different
PG version that doesn't even collect the same stats.

Another point is that ANALYZE is supposed to produce up-to-date stats,
but the remote server might not have up-to-date stats.  It's interesting
to speculate about getting around that by asking the remote server to do
an ANALYZE, but we can't assume that the local user has permissions
to do that.

There's been some discussion of providing facilities for dumping and
loading statistics, which was mainly thinking about improving pg_upgrade
but could also offer you a slightly-tedious solution for this situation.
It hasn't got past the arm-waving stage yet though.

			regards, tom lane




view thread (2+ messages)

Message-ID: <7371.1542208722@sss.pgh.pa.us>
Permalink:  ../7371.1542208722@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7371.1542208722@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, timur.luchkin@gmail.com
  Subject: Re: BUG #15506: Foreign data wrapper (postgres_fdw) unexpected behavior
  In-Reply-To: <7371.1542208722@sss.pgh.pa.us>
  References: <15506-9c8798a2d6cd06b0@postgresql.org> <7371.1542208722@sss.pgh.pa.us>

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

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