3 ms·
Ah so you don't actually have 1000 (or whatever) schemas set up right off the bat? Or I might be misunderstanding, and you're saying that you're just mapping w
by zeeg 15y ago
Ah so you don't actually have 1000 (or whatever) schemas set up right off the bat?
Or I might be misunderstanding, and you're saying that you're just mapping which physical server has the schemas
- mikeyk 15y agoWe 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.