Constraints

Constraints define integrity and consistency rules for data stored in tables. Snowflake provides support for constraints as defined in the ANSI SQL standard, as well as some extensions for compatibility with other databases, such as Oracle.

Note

  • For standard tables, Snowflake supports defining and maintaining constraints, but does not enforce them, except for NOT NULL constraints, which are always enforced.

    In this case, constraints are provided primarily for data modeling purposes and compatibility with other databases, as well as to support client tools that utilize constraints. For example, Tableau supports using constraints to perform join culling (join elimination), which can improve the performance of generated queries and cube refresh.

  • For hybrid tables, Snowflake both supports and enforces constraints. Primary key constraints are required and enforced on all hybrid tables, and other constraints are enforced when used.

Next Topics: