|
|
|
|
|
by garrettf
1714 days ago
|
|
> Can you share details on the routing? All in the application layer! All of our server code runs from the same repo, and every Postgres query gets routed through the same module. This means that it was relatively easy to add a required "shard key" argument to all of our existing queries, and then within our Postgres module consult an in-app mapping between shard key range and DB+schema. Plumbing that shard key argument through the application was more difficult, but luckily possible due to the hierarchical nature[0] of our data model. > Did you consider using several databases on the same Postgres host If I recall correctly, you cannot use a single client connection to connect to multiple databases on the same host, and so this could have ballooned our connection counts across the application. This is not something we explored too deeply though, would love to hear about potential benefits of splitting tables in this way. [0] https://www.notion.so/blog/data-model-behind-notion |
|