Re: BUG #15506: Foreign data wrapper (postgres_fdw) unexpected behavior - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #15506: Foreign data wrapper (postgres_fdw) unexpected behavior
Date
Msg-id 7371.1542208722@sss.pgh.pa.us
Whole thread Raw
In response to BUG #15506: Foreign data wrapper (postgres_fdw) unexpected behavior  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
=?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


pgsql-bugs by date:

Previous
From: "Purushotham"
Date:
Subject: Am unable to return after update/insert execute, let me know is it the way to create or else any other way?
Next
From: Thomas Munro
Date:
Subject: Re: BUG #15460: Error while creating index or constraint