'Is it possible or feasible to use the FDW extension from a local database to Cloud SQL?

I'm facing a situation where I have two PostgreSQL databases, one local and one in Cloud SQL. Some tables from the local database should be somewhat replicated in the cloud and vice-versa (it is not the case for an exact replica of the whole database, just part of it).

In this case, is it possible (or feasible performance-wise) to use the FDW extension from PostgreSQL to allow the access of the data from both ways? If not, what are some alternatives to replicate only parts of the database?

Thanks in advance.



Solution 1:[1]

Update: CloudSQL now accepts FDW. Docs here.


There is a limited list of allowed PostgreSQL extensions on Cloud SQL, and at the moment of writing this answer none of them are for FDW.

In the use case you described, a functionality similar to the Cloud SQL First Gen mySQL external master replication would be interesting, but for PostgreSQL this functionality is not yet supported.

In Google's issue tracker there are Feature Requests for both the external master in PostgreSQL and the support for FDW extensions (and also this duplicate issue), although it looks like the external master feature request has been marked as working as intended, so I'm guessing you should not expect this feature any time soon. The feature request for FDW extensions seem to be gaining some traction, so I would suggest to follow that issue to get any update.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1