Home > Database > Mysql Tutorial > body text

5 common database design mistakes

巴扎黑
Release: 2017-05-22 14:07:24
Original
1736 people have browsed it

Everyone makes mistakes, but as database administrators we should try to avoid them to reduce costs for the company and ensure data quality. The following five database design mistakes must arouse our vigilance.

1. Choose the appropriate data type to avoid excessive expansion of the database

Please pay attention to the choice of data type. For example, if you know that the value of a column ranges from 0 to 100,000, you don't need to use the BIGINT data type because the INT type will suffice.

Choosing the former means that every time you insert a piece of data, you waste 4 bytes than the latter. This may sound trivial, but as data volumes grow, the problem becomes apparent.

2. Follow ISO standards to ensure interoperability between heterogeneous database systems

The IT infrastructure of large enterprises is very complex and may require data exchange between different database systems. Let's take the TIMESTAMP data type as an example. The TIMESTAMP data type defined in Transact-SQL is different from the ISO standard. Other database systems also differ from ISO standards. Therefore, we must follow ISO standards as much as possible to ensure interoperability between heterogeneous database systems.

3. Implement serialization with appropriate mechanism

It is very necessary to ensure the serialization of records inserted into the database, and many database designers use various mechanisms to ensure the application of serialization. Some database designers like to introduce GUIDs into database designs, but introducing GUIDs is not a good choice because GUIDs are not serialized by default, and using GUID columns as primary keys and/or indexes can even cause performance problems.

4. Take foreign keys into account when creating indexes

If foreign keys have been defined in your database, you should pay more attention when building indexes and incorporate this situation into the overall database design.

5. Don’t ignore candidate keys related to business needs

Database designers should not focus solely on surrogate keys and forget about business requirements. Obviously, this is very detrimental to data quality. If you do not establish any constraints or indexes on business-relevant candidate keys, duplicate values ​​may appear.

Please stay away from the above five database design mistakes, which will help you save costs for your company and improve data quality.

【Related recommendations】

1. Mysql free video tutorial

2. How to make Mysql maintain the existing content Add the sql statement with content at the end

3. Summary of how to write commonly used SQL statements in MySQL

4. Use MySQL to generate random numbers and connect characters Detailed explanation of the string method

5. How to improve the speed of database query for millions of items

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!