Database design principles, or the ultimate goal:
- Efficient storage
- Efficient access
Recently learned some of the theoretical knowledge of the database on the Web (recently I like to start with video ...). It seems to be the video and blog, and now summarized as follows;
Overall structure: Demand analysis-"logical design-" Physical design-"maintenance and optimization;"
In fact, the speaker also believes that database design is a requirement, and the entire design contains the above four steps;
General statement
Direct
Here is the text version
- Demand Analysis: Analysis of the entire database to save what data, what characteristics of the data, what is the relationship between the data (clear data, clear data characteristics, clear data relationship);
- Logical design: Build a model/diagram for the data features and relationships in the previous step;
- Physical design: The design in the previous step is implemented in the database creation;
- Maintenance Optimization: The database is maintained or optimized according to requirements change and performance change;
Demand analysis
Give me a chestnut:
The above vivid interpretation of how to analyze the database requirements, and then the process of drawing, no longer repeat;
Logic Design
The first is the design of the ER diagram:
Then there are the various paradigms:
- The first paradigm: each attribute is single and non-detachable;
- The second paradigm: there is no redundancy in the table, there is no partial function dependency;
- The third paradigm: there is no transfer function dependency
Do not understand, well, maybe after some time I also can not understand, need some explanation to do:
The answer to the paradigm in the knowledge
There are actually a few points to note:
- The paradigm will be "backwards compatible";
- The basic 1 paradigm must be satisfied;
- Generally meet the BC paradigm can be;
- For convenience and performance considerations, most of the time the inverse paradigm design is required;
Below:
Physical design
Physical design is mainly to put the need to implement, here is the building of the database table, so it involves the choice of what library, to what specifications to build a table, the table of the problem of how to design the field;
Directly to the conclusion:
- For Internet projects, please choose MySQL directly;
- The table structure design should follow 1NF and appropriate inverse paradigm design;
- Table fields should follow the readability design;
- Data type selection Please choose the best choice based on business application;
- The primary key directly with the ID is good;
In a illustrated statement:
On the foreign key, trigger, reservation field of the disabled, you can further study; Of course, the work is in the use of ES, after the next to ponder
Maintenance optimization
Maintenance is optimized for better use of the database, so it can be handled for possible scenarios:
- Forget the meaning of this field--"Do comment
- Check table speed Slow--"index maintenance;
- There's too much data--"split the table.
This piece to say is not much, is the experience, the back has relevant experiences to fill up;
Database design that's the thing.