Batch Referential Integrity Constraints - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

Batch referential integrity is enforced as an all-or-nothing operation rather than row-by-row, and is therefore less expensive to enforce than standard referential integrity.

The system need not build and maintain reference indexes, so system performance improves.

Disks need not store reference indexes, so disk storage is available for other needs.

See Sizing a Reference Index Subtable for further information about reference indexes.

Batch referential integrity relationships are defined by specifying the WITH CHECK OPTION phrase for a REFERENCES constraint. When you specify this phrase, the database enforces the defined RI constraint at the granularity of a single transaction or request.

This form of RI is tested by joining the relevant parent and child table rows. If there is an inconsistency in the result, then the system rolls back the entire transaction in Teradata session mode or the problem request only in ANSI session mode.

There can be a tradeoff for this enhanced performance, because when an RI violation is detected, the entire transaction or request rolls back instead of one integrity-breaching row.

This is no different from the case for standard RI because for most transactions, only one row is involved.

There is a significant potential for performance problems when updating tables with batch RI constraints involving multiple update operations (such as an INSERT … SELECT or MERGE operation involving thousands or millions of rows). This is an expensive operation to roll back, cleanse, and rerun.

Large batch RI rollbacks can also occur with ALTER TABLE and CREATE TABLE statements whose referential integrity relationships do not verify.

Batch RI is best for tables whose normal workloads you can be confident are not going to cause RI violations.

You cannot use bulk data loading utilities like FastLoad, MultiLoad, or Teradata Parallel Transporter to load rows into tables defined with batch referential integrity.

Batch referential integrity is a Teradata extension to the ANSI SQL:2011 standard.