Help Center/
GaussDB/
Developer Guide(Distributed_8.x)/
Development and Design Proposal/
Database Object Design/
Constraint Design
Updated on 2024-08-20 GMT+08:00
Constraint Design
DEFAULT and NULL Constraints
- 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.
- Add NOT NULL constraints to columns that never have NULL values. The optimizer automatically optimizes the columns in certain scenarios.
- Explicitly name all constraints excluding NOT NULL and DEFAULT.
Unique Constraints
- The constraint name should indicate that it is a unique constraint, for example, UNIColumn name.
Primary Key Constraints
- The constraint name should indicate that it is a primary key constraint, for example, PKColumn name.
Check Constraints
- The constraint name should indicate that it is a check constraint, for example, CKColumn name.
Parent topic: Database Object Design
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot