I have to create a database for multiple companies, I have 2 options
A single
products
table, with acompany_id
field to differentiateOne table per company
products_company1
products_company2
products_company3
Important:
- Data stored of each client will be updated every 1 hour
- Each company has 2000 – 3000 records, and 15 company will be stored approx.
- Products table is an example, each company has more tables.
I did a search, but did not find information about multiple tables, only multiple databases (I don’t think multiple databases its a good option for me)
Advertisement
Answer
You want option 1 under almost all circumstances. Here are some reasons:
- Relational databases are optimized to work on large tables, not on large numbers of tables.
- Maintaining foreign key relationships is very challenging.
- Maintenance many tables (say by adding a column or changing a data type) is a nightmare compared to maintaining one table.
- Answering a simple question such as “how many companies have product X” is a nightmare.
There are no doubt other reasons as well. These come to mind.