This is a database design question.
I want to build an invoice web application, an invoice can have many items, and each user can have an inventory list of product items that they can store and choose to add to an invoice item.
My questions are:
1. Should I store all product inventory for all users using my application under one single table? Or have a separate product inventory table created for each user?
2. Is this even possible?
1 table is easier, but what if this single table grows too big, will I have a problem? (primary key INT).
A table per user is a bad idea. Keep all inventory in a single table, keyed on
userid. The table would have to be pretty massive for this to be a problem on any industrial-strength DBMS (you should wait till you have tens of millions of rows before even asking such questions).If you most commonly access inventory by user, you can speed up such queries by making the
useridthe first column of a clustered key, thus forcing inventory per user to clump together on disk. Again, though, don’t even ponder these issues until you observe an actual degradation in performance.