简体   繁体   中英

MySQL Database Design Optimization

(First off, sorry if this has been asked before, I searched for a while but its hard to find an older specific question sometimes)

I am currently working with an order management system (PHP, MySQL, HTML...) and I am considering some changes to the db schema for the next iteration.

I have tables such as Order, Purchase_Order, Inquiry, and a couple more that all have "notes", "files", and one or two more shared components. Right now they are all stored in their own respective tables (Order_Note, Purchase_Order_Note, Order_File, etc..). My question is will combining the "notes" into a single table be of any benefit?

Proposed:

table "Order" (Purchase_Order, etc..) stores all order-specific fields

table "Order_Note_Map" (PO_Note_Map, etc..) stores the ID of the order and ID of the related note

table "Notes" stores a notes details

Edit:

-the DB at the moment has less than 3,000 total "notes" spread across tables with that number increasing but not at a significant rate, roughly the same number of records for the other items I am asking about

-looking back I think a big caveat of the current system was with changing the components of a "note". instead of changing one table I have to make identical changes in multiple. Not a big deal if I can avoid a major DB change

This question would be clear if you can tell how much of records are you having in these tables or expecting. If they are high volume then I would suggest combining into one would help as you would not be joining tables to get data. Joining would be costly in large data set.

The short answer is no because you will only have a join less and it sounds like you will have to change a lot just to change this thing. If your database is "huge" it will be smart to put the notes into a single table but if your database won't be to big it won't change anything. It will only be a little faster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM