Skip to content

docs(#1512): specify FK-column indexing on PostgreSQL - #244

Merged
dimitri-yatsenko merged 1 commit into
mainfrom
fix/1512-fk-index-docs
Aug 11, 2026
Merged

docs(#1512): specify FK-column indexing on PostgreSQL#244
dimitri-yatsenko merged 1 commit into
mainfrom
fix/1512-fk-index-docs

Conversation

@dimitri-yatsenko

Copy link
Copy Markdown
Member

Documents the behavior added in datajoint/datajoint-python#1526 (closes #1512), and flips the now-obsolete guidance from #227.

Changes

  • reference/specs/table-declaration.md §2.6 (new) — Foreign-Key Indexes. Normative statement of the guarantee: FK columns are indexed on both backends — implicit on MySQL/InnoDB, emitted by DataJoint on PostgreSQL — and the emitted index is coverage-aware (skipped when the columns are already a left-prefix of the PK, a declared index, or a wider FK index). Notes that lifecycle on FK drop / alter() is out of declaration scope.
  • reference/specs/database-backends.md §Backend-Specific Behavior. Adds a "Foreign-key column index" row (Implicit / Emitted by DataJoint) with a pointer to the declaration spec — the difference is only who creates the index.
  • explanation/referential-integrity.md §5. Flips the guidance added in docs: add Data Integrity, Referential Integrity, and Transactions explanation pages #227: it previously told users to declare an explicit index(...) on PostgreSQL; that index is now created by the framework, so the mental model "the database indexes foreign-key columns" holds on both backends.

Why now (not the spec-reshape)

§5's old text becomes actively wrong the moment #1526 merges (it tells users to hand-declare an index the framework now creates), so this shouldn't wait for the larger diagram-operations spec reshape.

- table-declaration spec §2.6 (new): DataJoint guarantees FK columns are indexed
  on both backends — implicit on MySQL/InnoDB, emitted (coverage-aware) on
  PostgreSQL; skipped when already a left-prefix of the PK or a declared index.
- database-backends spec: add the FK-index row to Backend-Specific Behavior with
  a pointer to the declaration spec.
- referential-integrity explanation §5: flip the now-obsolete guidance to declare
  an explicit index on PostgreSQL; the database indexes FK columns on both
  backends. Pairs with datajoint-python #1526.
@dimitri-yatsenko dimitri-yatsenko added the documentation Improvements or additions to documentation label Aug 11, 2026
@dimitri-yatsenko
dimitri-yatsenko merged commit c339b00 into main Aug 11, 2026
2 checks passed
@dimitri-yatsenko
dimitri-yatsenko deleted the fix/1512-fk-index-docs branch August 11, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants