Home  >  Article  >  Backend Development  >  Mysql database design issues.

Mysql database design issues.

WBOY
WBOYOriginal
2016-09-01 00:20:131107browse

I recently encountered some mysql design issues, which were a bit disturbing, so I came to discuss them with you.

My first question is, is database design very important in the early stage of software development?

If you ask me to answer this question, I think it is very important. But the leaders don't think so now. They think that the data is as simple as being stored in the database, so it should be very fast.
But the current demand is like this. What we are doing now is the strategy of product marketing activities. These strategies are relatively flexible, such as

  1. If you order more than 10 pieces of all products under a certain brand, you can order 1 piece of a popular item, with a maximum of 5 pieces of this popular item.

  2. Order 5 pieces of a certain product, and you will be rewarded with A1 piece of a popular product + B1 piece of a popular product.

  3. A certain popular item is only open to VIP3 and above, and the number of items that can be ordered is different depending on the VIP level.

Wait, wait, wait. . There are many restrictions and rules. The leader's idea is to save data, put these activity rules in a json string and save it in mysql. My idea is to split the tables as much as possible, because mysql is a relational database, and it is stored in json strings, which is not conducive to reading. This is where the disagreement arises. . Then the second question comes,

The second question is whether it is appropriate to put these rules and restrictions in a json string? How to better store and manage these flexible activity rules.

Thank you all in advance, thank you all, ~(≧▽≦)/~ la la la.

Reply content:

I recently encountered some mysql design issues, which were a bit disturbing, so I came to discuss them with you.

My first question is, is database design very important in the early stage of software development?

If you ask me to answer this question, I think it is very important. But the leaders don't think so now. They think that the data is as simple as being stored in the database, so it should be very fast.
But the current demand is like this. What we are doing now is the strategy of product marketing activities. These strategies are relatively flexible, such as

  1. If you order more than 10 pieces of all products under a certain brand, you can order 1 piece of a popular item, with a maximum of 5 pieces of this popular item.

  2. Order 5 pieces of a certain product, and you will be rewarded with A1 piece of a popular product + B1 piece of a popular product.

  3. A certain popular item is only open to VIP3 and above, and the number of items that can be ordered is different depending on the VIP level.

Wait, wait, wait. . There are many restrictions and rules. The leader's idea is to save data, put these activity rules in a json string and save it in mysql. My idea is to split the tables as much as possible, because mysql is a relational database, and it is stored in json strings, which is not conducive to reading. This is where the disagreement arises. . Then the second question comes,

The second question is whether it is appropriate to put these rules and restrictions in a json string? How to better store and manage these flexible activity rules.

Thank you all in advance, thank you all, ~(≧▽≦)/~ la la la.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn