In this section, we have chosen to represent database shards as PostgreSQL schema names. If our basic schema is named myapp, shard 1 would be myapp1, shard 15 would be myapp15, and so on. This is what we call the logical shard name.
Beyond this, shards should be independent of each other so that they can be relocated to another PostgreSQL server arbitrarily; however, if shards can be moved at will, how do we find them? In much the same way that LVM has a physical drive, logical shards have a corresponding physical shard. The physical shard is the server where the logical shard currently resides, as shown in the following diagram:
Elements such as clients, products, and vendors are shared resources that all PostgreSQL shard servers can use. This is where our foreign tables would be beneficial. The logical shards (schemas) myapp1 through myapp4 all...