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 the NOT NULL constraint for columns that do not 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.