Reputation: 196
I am trying to design a POS application to be used by different users for their stores.
For eg. One client has one store.
Another client also has another store.
Now each store will have their own set of products, stock, outlets, registers, billing, sales, etc.
Now I can imagine each store has thousand of products with thousands of sales per day. Is it viable to store all the sales data for all stores in one table or should i dynamically create different table for each store.
What is the correct/recommended method to overcome this situation?
Thanks in advance.
Upvotes: 1
Views: 2483
Reputation: 55
should i dynamically create different table for each store.
Why would you do that ? That would be programmatically horrifying as you dynamically have to generate a new unique table name every new customers are created. It's practically poor design to add tables dynamically. Imagine your app does scale and have millions of customers/stores, that would mean your database would contain millions of customers table, not included with other transactional tables. Having millions of rows in a single table is far better than having millions of tables
What you should do is keep things simple. Store the sales data with customer_id or store_id instead and make sure they're indexed which will significantly increase performance
Upvotes: 1