Remote tables provide an easy and convenient way to access remote data in a PostgreSQL database. This is good for highly available systems, as a properly compartmentalized system invites segmented maintenance. Yet, remote data comes with a rather drastic cost regarding data fetching and handling overhead.
PostgreSQL 9.3 introduced the internal support of materialized views. Traditionally, materialized views merely instantiate a view into a physical structure to avoid expensive or complicated query plans and result sets. They also make it possible to index or optimize a view in ways that are not normally possible. Now, imagine what we can do with such a structure when utilizing foreign tables.
In this recipe, we will explore how materialized views can drastically increase the local data-access capability within a PostgreSQL database...