How to do it...

Follow these steps to build a complete database-sharding API:

  1. Learn one of the PostgreSQL procedural languages.
  2. Create a table to track shard-configuration settings.
  3. Write one or more functions to manage shard-configuration settings.
  4. Create a table to track shard tables and source schemas.
  5. Write a next_unique_id equivalent function.
  6. Write one or more functions to control which tables are managed.
  7. Write one or more functions to build or alter each shard's structure based on the tables it contains.
  8. Create a table to track logical to physical shard mappings.
  9. Write one or more functions to manage logical to physical shard mappings.
  10. Write one or more functions to grant sufficient permissions to users tasked with using all of the ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.