"Albe Laurenz" <laurenz.albe@wien.gv.at> writes:
> I think that the price of a remote table scan is something
> we should be willing to pay for good local statistics.
> And there is always the option not to analyze the foreign
> table if you are not willing to pay that price.
> Maybe the FDW API could be extended so that foreign data wrappers
> can provide a random sample to avoid a full table scan.
The one thing that seems pretty clear from this discussion is that one
size doesn't fit all. I think we really ought to provide a hook so that
the FDW can determine whether ANALYZE applies to its foreign tables at
all, and how to obtain the sample rows if it does.
Since we've already whacked the FDW API around in incompatible ways for
9.2, now is probably a good time to add that. I'm inclined to say this
should happen whether or not we accept any of the currently proposed
patches for 9.2, because if the hook is there it will provide a way for
people to experiment with foreign-table ANALYZE operations outside of
core.
regards, tom lane