Home > database >  Would like to ask: how do I this data structure optimization design
Would like to ask: how do I this data structure optimization design

Time:09-16

100000 a data of a total product data sheets, there are 10000 businesses, are available from the data in the table to choose goods on their own online shop, my preliminary idea is when choosing products, a businessman from the total product list will choose the product copy one assigned to the merchants product list, but worry that merchants product table is too big (copy each merchants from the total product list 1000 goods, article 10000 of the 10 million businesses is data)
Would like to ask: how do I this data structure design to optimize thank you

CodePudding user response:

Edit view of total product data table, the businessman choose products is to choose the view, so businesses will share a database,

CodePudding user response:

First of all, still need a business product table, or the business what product this information all don't know how to value

If is 3 nf modeling, products and businesses is a many-to-many relationship, this time had to make a business with the product table to mark their relationship
Merchants product table: the ID, merchant ID, product ID, add time
Probably so several fields with respect to OK, if you need to query the businessman product information, need to merchants table, by means of table joins product table, the businessman product table to implement
MySQL database is stored, if the column a few cases, even if the large amount of data, are not very real storage

If you want to continue to use your pattern design, reduce the table joins, can consider through the merchant id hash partitioning,

Depots table, of course, is also OK, but the impact on the application layer will be larger,

CodePudding user response:

My personal advice is don't be afraid of table is too big, or the two tables: a table is commodity library, only to save this article 1000 data; Library another table is the merchant's goods, merchants chose 1000 data, just copy the article 1000 data, index, and caching, behind the table is too big to consider depots table,
Because businesses may modify the commodity information, maintaining inventory, sorting operation, such as each merchants each commodity information may not be the same,
  • Related