24.4. Data Partitioning

Data partitioning splits tables into data sets. Each set can only be modified by one server. For example, data can be partitioned by offices, e.g. London and Paris. While London and Paris servers have all data records, only London can modify London records, and Paris can only modify Paris records.

Such partitioning implements both failover and load balancing. Failover is achieved because the data resides on both servers, and this is an ideal way to enable failover if the servers share a slow communication channel. Load balancing is possible because read requests can go to any of the servers, and write requests are split among the servers. Of course, the communication to keep all the servers up-to-date adds overhead, so ideally the write load should be low, or localized as in the London/Paris example above.

Data partitioning is usually handled by application code, though rules and triggers can be used to keep the read-only data sets current. Slony can also be used in such a setup. While Slony replicates only entire tables, London and Paris can be placed in separate tables, and inheritance can be used to access both tables using a single table name.