Sample Header Ad - 728x90

MySQL Sharding with org id

0 votes
1 answer
153 views
I have a multi tenant application and each tenant will have an orgId. So, all tables will have orgid column. Each org will have clients, projects, ... **Tables** org client project Now, I am trying to understand sharding here. So, I will have a metadata database where org to DB mapping is present. And, will have multiple DBs. Each DB will host few org data. My questions is, Say, DB A --> is a metadata DB. DB B --> Hosting org data for org 1 & 2 DB C --> Hosting org data for org 3 & 4 DB D --> Hosting org data for org 4 & 5 & 6 **DB A** Metadata DB will have a table for ORG to DB mapping. So, **Table :-** org_db **Columns :-**. org_id, db In, "DB B", we have a project table and id starts from 1 and this table will have org_id as well. In, "DB C", we have a project table and id starts from 1 and this table will have org_id as well. Now, I feel that org 3 & 4 data is small, so DB C can be merged with DB B. If that is the case, How can we merge the project Id as project id start from 1 in both the DB's.
Asked by user1578872 (79 rep)
Jun 11, 2021, 04:33 PM
Last activity: Jul 11, 2025, 04:10 PM