Introduction:I have been engaged in database development and design, and I have read some books. A long time ago, I wanted to sort out and summarize the relational database design. However, for various reasons, I was too late to start the work, mainly due to inertia. Today, I am determined to start this amazing and exciting job. This will be a series of articles. I will discuss my laziness in a speech, and I will use the summary here to train new people ).
In the first lecture of the series, let's answer the following questions:
Database is the foundation of the building
Most programmers are eager to understand the basic requirements and want to quickly enter the encoding stage. Only the code output can reflect the workload.
This leaves many potential risks to the system. Many software system problems, such as incorrect output data, poor performance or complicated maintenance at the later stage, are closely related to the preliminary database design. At this point, the attempt to modify the database design or optimize the database is equivalent to overthrowing it.
I often compare software development to automobile manufacturing. Automobile Manufacturing will go through the steps of drawing design, model making, sample vehicle manufacturing, small batch production, and finally batch production. The entire process is interlocking, And the next process is based on the premise that the previous process is correct. If there is a leak in the drawing design stage, we can re-design the drawings. If this error is found in the model manufacturing stage, we should re-start from the drawing design stage to the model manufacturing stage, the more problems with the design are found later, the more expensive the modification is.
Databases are the foundation of the entire application. Without a solid foundation, the entire application is in danger.
Powerful databases are powerless in the face of poor Designs
Modern Database Management System (DBMS) provides convenient graphical interface tools. These tools can be used to easily create tables and define columns. But can we design a structure?
Relational databases have many very good features, but improper design will make these features partially or completely lost.
Let's take a look at the followingScenarios caused by poor Database Design:
1. Loss of Data Consistency
An order management system maintains the order information of customers and customers. After a user who uses the system receives a call from the customer to modify the Receiving address, the user modifies the Receiving address on the customer information page of the system, however, the original order of the customer still sent the wrong address.
2. Loss of data integrity
The company's strategic transfer is ready to withdraw from a region. The system operator deletes the configuration information of the region in the system. The system prompts that the region is deleted successfully. Then the problem came. The customer service staff found that the historical order page in the region encountered an error as soon as it was opened.
3. Performance Loss
In an inventory management system, the Warehouse administrator uses this system to record each incoming and outgoing goods and view the inventory of each current goods. After the system was running for a few months, the repository administrator found that opening the current inventory page was very slow and the overall trend was getting slower and slower.
The above scenarios are caused by improper database design. The root causes include: redundant fields are introduced during design, no reasonable design constraints, and no adequate performance design, the above example is just a drop in the ocean.