Home  >  Article  >  Database  >  Analyze mysql database design skills

Analyze mysql database design skills

怪我咯
怪我咯Original
2017-03-31 10:25:461769browse


Analyze mysql database design skills


Use clear and unified labels and column names, such as Person, StudentID.
Use singular instead of plural for table names, such as SchoolName, not SchoolNames.
Do not use spaces in table names.
Do not use unnecessary prefixes or suffixes in table names, such as School instead of TblSchool, or SchoolTable, etc.
The password in the database must be encrypted and then decrypted in the application. (In fact, it is hash storage, one-way encryption)
Use integer as the ID field. Maybe it is not necessary now, but it will be needed in the future, such as related tables, indexes , etc.
Use integer fields for indexing, otherwise it will cause big performance problems.
Using bit as a boolean field, using integer or varcha is a waste. Also, such fields should start with "Is".
Must be authenticated to access the database, do not give every user administrator permissions.
Try to avoid using "select *" and use "select [required_column_list]" for better performance.
If the program code is more complex, use an ORM framework, such as hibernate, iBatis. Performance problems of the ORM framework can be solved through detailed configuration.
Split infrequently used tables to different physical storage for better performance.
For critical databases, use secure backup systems such as clustering, synchronization, etc.
Use foreign keys, non-null and other restrictions to ensure data integrity, don't throw everything to the program.
Lack of database documentation is fatal. You should document your database design, including triggers, stored procedures, and other scripts.
For frequently used queries and large data tables, use indexes. Data analysis tools can help you decide how to index.
The database server and web server should be placed on different machines. This improves security and reduces CPU pressure.
Image and blob fields should not be defined in commonly used data tables, otherwise performance will be affected.
Normalization should be used as required to improve performance. Insufficient Normalization will lead to data redundancy, while excessive Normalization will lead to too many joins and data tables, both of which will affect performance.
Spend more time on database design, otherwise you will pay double the time in the future.

Time has proven that many program efficiency problems are actually caused by unreasonable database design, so being able to design a reasonable database is crucial to the entire software and website!


The above is the detailed content of Analyze mysql database design skills. For more information, please follow other related articles on the PHP Chinese website!

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