# referential-integrity

Published articles for referential-integrity.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Foreign keys are not overhead, and the thing you measured was a missing index

DevFeed: [Foreign keys are not overhead, and the thing you measured was a missing index](<https://devfeed.tech/articles/foreign-keys-are-not-overhead-and-the-thing-you-measured-was-a-missing-index-39597.md>)

Original publisher: [Read original article](<https://ankit-rana.com/logs/45-foreign-keys-are-not-overhead/>)

Author: hello@ankit-rana.com

Published: 2026-08-30T00:00:00Z

Content type: opinion

Language: en

Sources: [Ankit Rana | Mechanical Sympathy](<https://devfeed.tech/sources/ankit-rana-mechanical-sympathy.md>)

Topics: [Database](<https://devfeed.tech/topics/database.md>), [integrity](<https://devfeed.tech/topics/integrity.md>)

Tags: [database](<https://devfeed.tech/tags/database.md>), [database-performance](<https://devfeed.tech/tags/database-performance.md>), [foreign-keys](<https://devfeed.tech/tags/foreign-keys.md>), [indexing](<https://devfeed.tech/tags/indexing.md>), [integrity](<https://devfeed.tech/tags/integrity.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [referential-integrity](<https://devfeed.tech/tags/referential-integrity.md>), [schema-design](<https://devfeed.tech/tags/schema-design.md>)

### AI overview

The article explains that the measured cost of a slow parent delete is usually caused by a missing index on the child table's foreign-key column, not by foreign-key checking itself. It argues that dropping the constraint merely moves referential-integrity enforcement into application code and can allow orphaned records.

### Source excerpt

A foreign key check is an index lookup against a primary key that is almost certainly already in cache, which is close to the cheapest thing a database does. The expensive case people measure is a parent delete with no index on the child's referencing column, which forces a full scan of the child table per deleted row, and that is a missing index rather than a cost of the constraint. Dropping the key does not remove the work, it moves the integrity guarantee into application code where nothing reports when it stops holding.