DB: 20 database design best practices

Source: Internet
Author: User

DB: 20 database design best practices

Code

 

  1. Use clear and uniform labels and column names, such as school, schoolcourse, and courceid.
  2. The data table name uses a singular number instead of a plural number, for example, 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 using school instead of tblschool or schooltable.
  5. The password in the database must 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. Separate infrequently used data tables to different physical storage for better performance.
  13. For key databases, use secure backup systems, such as clusters 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 are 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.

. Original link: http://www.javacodegeeks.com/2012/02/20-database-design-best-practices.html

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.