3 ms·
We set-up the schemas ahead of time, and then each lookup is (with, say, 1000 schemas): user_id % 1000 -> schema ID schema ID -> database ID then select F
by mikeyk 15y ago
We set-up the schemas ahead of time, and then each lookup is (with, say, 1000 schemas):
user_id % 1000 -> schema ID
schema ID -> database ID
then select FROM schemaID.tablename etc on that particular database.
- zeeg 15y agoAh ok that's what I figured. We do a lot of the same things right now with various DBs (we just describe it as pre-sharding so we can avoid the actual re-sharding dilemma). We've had to do this with both PostgreSQL and Redis now. The schemas are definitely a neat way to handle this though so you dont have to worry about table names.