Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-3.x)/ Development and Design Proposal/ Database Design Specifications/ Constraint Design
Updated on 2025-08-19 GMT+08:00
Constraint Design
DEFAULT and NULL Constraints
- [Recommendation] If all the column values can be obtained from services, you are advised not to use the DEFAULT constraint. Otherwise, unexpected results will be generated during data loading.
- [Recommendation] Add NOT NULL constraints to columns that never have NULL values. The optimizer automatically optimizes the columns in certain scenarios.
- [Recommendation] Explicitly name all constraints excluding NOT NULL and DEFAULT.
Unique Constraints
- [Recommendation] The constraint name should indicate that it is a unique constraint, for example, UNIIncluded columns.
Primary Key Constraints
- [Recommendation] The constraint name should indicate that it is a primary key constraint, for example, PKColumn name.
Check Constraints
- [Recommendation] The constraint name should indicate that it is a check constraint, for example, CKColumn name.
Parent topic: Database Design Specifications
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.
The system is busy. Please try again later.