Sharing 20 best practices for Database Design

Source: Internet
Author: User

Database design is one of the key points of the entire program. In order to support the relevant program running, the best database design is often not achieved overnight. It is a complicated process that can only be repeatedly explored and gradually refined, it is also a process of planning data objects in a structured database and the relationship between these data objects. The following provides 20 best practices for database design. Of course, the so-called best practice depends on whether it is suitable for your program. Let's get to know about it.

1. Use clear and uniform labels and column names, such as School, SchoolCourse, and CourceID.
2. The data table name uses the singular number rather than the plural number, such as StudentCourse, instead of StudentCourses.
3. Do not use spaces for data table names.
4. Do not use unnecessary prefixes or suffixes for data table names, such as School instead of TblSchool or SchoolTable.
5. The password in the database should be encrypted and decrypted in the application. (Hash Storage and one-way encryption)
6. Using an integer as the ID field may not be necessary now, but it will be required in the future, such as associated tables and indexes.
7. Use integer fields for indexing. Otherwise, it may cause high performance problems.
8. Using bit as a Boolean field, using an integer or varcha is a waste. At the same time, such fields should start with "Is.
9. The database can be accessed only after authentication. do not grant administrator permissions to each user.
10. Avoid using "select *" whenever possible, and use "select [required_column_list]" to achieve better performance.
11. If the program code is complex, use the ORM framework, such as hibernate and iBatis. The performance problems of the orm framework can be solved through detailed configuration.
12. Split infrequently used data tables into different physical storage for better performance.
13. For key databases, use a secure backup system, such as cluster and synchronization.
14. Use foreign keys and non-empty restrictions to ensure data integrity. Do not throw everything to the program.
15. The lack of database documentation is fatal. You should design documents for your database, including triggers, stored procedures, and other scripts.
16. Indexes should be used for frequently used queries and large data tables. Data analysis tools help you decide how to create indexes.
17. database servers and web servers should be placed on different machines. This improves security and reduces CPU pressure.
18. Image and blob fields should not be defined in common data tables; otherwise, performance will be affected.
19. Normalization needs to be used as required to improve performance. Not enough Normalization will lead to data redundancy, and excessive Normalization will lead to too many joins and data tables, both of which will affect the performance.
20. Spend more time on database design. Otherwise, you will pay twice in the future.

Javacodegeeks.com

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.