CertSafari
    Snowflake SnowPro Advanced: Architect (ARA-C01)· Lessons

    Domain 2 · Lesson 4/13

    Snowflake Constraints: ENABLE, VALIDATE and RELY

    Outline the benefits and limitations of various data models in a Snowflake environment.

    10 min read
    6% of exam
    5 sources
    Published 5 Oct 2026
    Docs as of 4 Oct 2026

    What you will be able to do

    • State which constraint types Snowflake enforces on standard tables compared with hybrid tables
    • Explain what the ENABLE, VALIDATE and RELY properties do and what their defaults are
    • Explain how RELY allows join elimination, and the risk of setting it on data that doesn't comply

    1.Which constraints Snowflake actually enforces

    Snowflake supports the five ANSI constraint types: PRIMARY KEY, UNIQUE, FOREIGN KEY, NOT NULL and CHECK. A table can have several unique keys and foreign keys but only one primary key. Whether a constraint is enforced depends on the table type, not on how you declare it.

    Constraint enforcement by table type
    ConstraintStandard tablesHybrid tables
    PRIMARY KEYOptional, not enforcedRequired, enforced
    FOREIGN KEYOptional, not enforcedOptional, enforced (referential integrity)
    UNIQUEOptional, not enforcedOptional, enforced
    NOT NULLOptional, enforcedOptional, enforced
    CHECKOptional, enforcedOptional, enforced; can be defined only at table creation

    On standard tables, NOT NULL and CHECK are the only constraints Snowflake enforces, and that holds whatever the ENFORCED property says. A duplicate primary key value or an orphaned foreign key loads without any error. On hybrid tables you can't set NOT ENFORCED on PRIMARY KEY, FOREIGN KEY or UNIQUE constraints.

    CHECK constraints are checked during INSERT, UPDATE, MERGE and CREATE TABLE … AS SELECT. If the condition evaluates to TRUE or NULL, the operation goes ahead. If it evaluates to FALSE, the operation fails. This matters for ingestion design: a COPY INTO a table with CHECK constraints fails, and so does creating a pipe that targets one.

    Checkpoint 1 of 6· Exam question

    A data architect describes a Snowflake schema design where a central fact table storing sales transactions is directly joined to denormalized dimension tables such as CUSTOMER, PRODUCT, and DATE, each containing all descriptive attributes in a single table. Which data modeling approach does this describe?

    Checkpoint 2 of 6· Check yourself

    A standard table has CHECK (quantity > 0). An INSERT supplies a row where quantity is NULL. What happens?

    Sources12

    2.ENABLE, VALIDATE and RELY: Snowflake's extension properties

    Key constraints accept a set of properties: [NOT] ENFORCED, [NOT] DEFERRABLE, INITIALLY {DEFERRED | IMMEDIATE}, ENABLE | DISABLE, VALIDATE | NOVALIDATE, and RELY | NORELY. The last three are Snowflake extensions, not ANSI properties. On standard tables, these properties are there to make migrating from other databases easier, and Snowflake neither enforces nor maintains them. You can change their defaults, but if you do, Snowflake doesn't create the constraint. The one exception is RELY.

    Constraint properties and their defaults
    PropertyWhat it specifiesDefault
    ENFORCED | NOT ENFORCEDWhether the constraint is enforced in a transactionNOT ENFORCED
    ENABLE | DISABLEWhether the constraint is enabled; provided for compatibility with OracleDISABLE
    VALIDATE | NOVALIDATEWhether to validate existing data on the table when the constraint is createdNOVALIDATE for PRIMARY KEY and FOREIGN KEY; VALIDATE for CHECK
    RELY | NORELYWhether a NOVALIDATE constraint is taken into account during query rewriteNORELY

    CHECK constraints use ENABLE with either VALIDATE or NOVALIDATE. ENABLE VALIDATE is the default. It applies the check to existing rows and to every later insert or update, but you can only use it on new tables. ENABLE NOVALIDATE applies the check only to rows inserted or updated after you run the command. If you later switch a CHECK from NOVALIDATE to VALIDATE, Snowflake checks all existing rows before making the change.

    After a constraint exists, you can change some properties, such as RELY, with ALTER TABLE. Others, such as DEFERRABLE, can't be changed: you have to drop the constraint and create it again.

    ALTER TABLE syntax for changing constraint propertiessql
    ALTER TABLE <table_name>
      { ALTER | MODIFY } {
          CONSTRAINT <name>
        | PRIMARY KEY
        | { UNIQUE | FOREIGN KEY } (<column_name>, [ ... ] )
      }
      { [ [ NOT ] ENFORCED ] [ VALIDATE | NOVALIDATE ] [ RELY | NORELY ] };

    Checkpoint 3 of 6· Match them up

    Match each constraint property to what the documentation says about it

    Tap a term, then the definition that fits it.

    Checkpoint 4 of 6· Exam question

    A BI team building executive dashboards in Tableau reports that ad hoc drill-down queries against the star-schema sales mart run consistently fast, even though analysts frequently change which dimensions they filter on. Which characteristic of the star schema design best explains this consistent performance?

    Sources213

    3.RELY and join elimination

    An unnecessary left outer join that Snowflake can eliminatesql
    SELECT f.*
    FROM fact_sales f
    LEFT OUTER JOIN dim_products p
    ON f.product_id = p.product_id;

    The join is unnecessary because the query doesn't use any dim_products column apart from the join key. If dim_products.product_id carries a UNIQUE or PRIMARY KEY constraint with RELY, Snowflake drops the reference to dim_products. The documentation shows the same optimization for an unnecessary self-join and for an unnecessary join on a primary key and foreign key. When a primary key and a foreign key are related, set RELY on both of them. Client tools can benefit too: Tableau, for example, uses constraints for join culling.

    RELY doesn't check anything. It tells the optimizer to trust that the data meets the constraint, and making sure that's true is your job. If the data breaks the constraint, a query can return different results with RELY than with NORELY. It's worse for writes: DML and CTAS statements may insert incorrect data. The safe pattern is to verify integrity in the pipeline, set RELY, and keep verifying.

    Checkpoint 5 of 6· Exam question

    A retail analytics team maintains a star schema where the PRODUCT dimension stores category, subcategory, brand, and supplier name directly in one wide table. Six months after launch, the team notices they must update thousands of dimension rows whenever a supplier renames a brand, and storage for the dimension table has grown faster than the count of distinct products. Which TWO limitations of the star schema design explain what the team is experiencing? (Select 2)(Select 2)

    Checkpoint 6 of 6· Check yourself

    RELY is set on the PRIMARY KEY of CUSTOMER and the FOREIGN KEY on ORDERS. A later load inserts orders with customer_id values that aren't in CUSTOMER. What is the risk?

    Sources425

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Declaring a PRIMARY KEY or FOREIGN KEY on a standard table stops duplicate or orphaned rows from being loaded.Why is that wrong?

      On standard tables, only NOT NULL and CHECK are enforced. Key constraints are informational, and only hybrid tables enforce them.

      Covered in Which constraints Snowflake actually enforces

    2. 2.Setting RELY makes Snowflake validate the data against the constraint.Why is that wrong?

      RELY only lets the optimizer take the constraint into account when it rewrites queries. Making sure the data complies is still your responsibility.

      Covered in RELY and join elimination

    3. 3.You can add a CHECK constraint with ENABLE VALIDATE to an existing table to check the rows already in it.Why is that wrong?

      ENABLE VALIDATE is only supported for new tables. On an existing table, ENABLE NOVALIDATE checks only rows inserted or updated afterwards.

      Covered in ENABLE, VALIDATE and RELY: Snowflake's extension properties

    Practise it for real

    Show that key constraints on standard tables are informational metadata, then mark them for the optimizer to use with RELY

    1. 1.Run the CREATE OR REPLACE TABLE statements for salespeople and salesorders from Snowflake's table design documentation

      Why: These give you a primary key and an out-of-line foreign key between two standard tables

      You should see: Both tables are created, with constraints PK_SP_ID, PK_ORDER_ID and FK_SP_ID

    2. 2.Insert a row into salesorders whose sp_id has no matching row in salespeople

      Why: This shows that FOREIGN KEY constraints are not enforced on standard tables

      You should see: The insert succeeds without an error

    3. 3.Run SELECT GET_DDL('TABLE', 'mydb.public.salesorders'); using your own database name

      Why: GET_DDL returns the constraints currently defined on the table

      You should see: Key constraints appear as out-of-line clauses. The unnamed unique constraint is shown without its system-generated name.

    4. 4.Query INFORMATION_SCHEMA.TABLE_CONSTRAINTS for the schema, filtering on constraint_schema = 'PUBLIC'

      Why: This lists every table constraint in the schema, which is useful for auditing a model

      You should see: A row for each constraint, including SYS_CONSTRAINT_ names for the unnamed UNIQUE constraints

    5. 5.Delete the orphaned row, then use ALTER TABLE … ALTER CONSTRAINT … RELY on both pk_sp_id and fk_sp_id

      Why: Set RELY only after the data complies, and set it on both related constraints

      You should see: Both constraints now have the RELY property. No data is checked when you do this.

    Stuck? Get a nudge

    If the RELY step seems to have no effect, remember that RELY changes how the optimizer treats queries, not what data the table accepts.

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “A PRIMARY KEY constraint implies that the column is both NOT NULL and UNIQUE.”
      ↩︎ Which constraints Snowflake actually enforces
      “If you attempt to COPY INTO a table with CHECK constraints, the operation fails.”
      ↩︎ Which constraints Snowflake actually enforces
      “ENABLE NOVALIDATE enforces the constraint for all rows that are inserted or updated after you run the command”
      ↩︎ ENABLE, VALIDATE and RELY: Snowflake's extension properties
      “ENABLE VALIDATE is only supported for new tables, not for existing tables.”
      ↩︎ Exam trap 3
      “If the condition evaluates to TRUE or NULL, the DML operation proceeds.”
      ↩︎ Checkpoint
    2. 2.
      “For standard tables, NOT NULL and CHECK are the only types of constraints that are enforced by Snowflake”
      ↩︎ Which constraints Snowflake actually enforces
      “these properties are provided to facilitate migrating from other databases. They are not enforced or maintained by Snowflake.”
      ↩︎ ENABLE, VALIDATE and RELY: Snowflake's extension properties
      “changing the defaults results in Snowflake not creating the constraint”
      ↩︎ ENABLE, VALIDATE and RELY: Snowflake's extension properties
      “These properties are provided for compatibility with Oracle.”
      ↩︎ ENABLE, VALIDATE and RELY: Snowflake's extension properties
      “For related PRIMARY KEY and FOREIGN KEY constraints, set this property on both constraints.”
      ↩︎ RELY and join elimination
      “a violation of referential integrity occurs, DML and CTAS statements might insert incorrect data”
      ↩︎ RELY and join elimination
      “For standard tables, NOT NULL and CHECK are the only types of constraints that are enforced by Snowflake”
      ↩︎ Exam trap 1
      “For standard tables, it is your responsibility to enforce RELY constraints; otherwise, you might risk unintended behavior and unexpected results.”
      ↩︎ Exam trap 2
      “Specifies whether a constraint in NOVALIDATE mode is taken into account during query rewrite.”
      ↩︎ Checkpoint
    3. 4.
      “The join is unnecessary because the statement does not refer to any columns in the dim_products table on the right”
      ↩︎ RELY and join elimination
      “If the dim_products.product_id column has the UNIQUE or PRIMARY KEY constraint with the RELY property, Snowflake can identify this join as unnecessary”
      ↩︎ Prediction
      “If the integrity of your constraints is not maintained, the query results might differ if the RELY constraint property is set”
      ↩︎ Checkpoint
    4. 5.
      “Tableau supports using constraints to perform join culling (join elimination)”
      ↩︎ RELY and join elimination

    Spotted a mistake, or was something unclear? Tell us.