When the problem is not the number of concurrent queries, but the size of the database and the speed of a single query, a different approach can be implemented. The data can be separated into several servers, which will be queried in parallel, and then the result of the queries will be consolidated outside of those databases. This is called data sharding.
PostgreSQL provides a way to implement sharding based on table partitioning, where partitions are located on different servers and another one, the master server, uses them as foreign tables. We discussed partitioning in Chapter 08, OLAP and Data Warehousing, and foreign tables in Chapter 14, Testing. When performing a query on a parent table defined on the master server, depending ...