Skip to content

Remove UNIQUE constraints that cause btree overflow#3

Merged
jakebromberg merged 1 commit intomainfrom
fix/remove-unique-constraints
Feb 14, 2026
Merged

Remove UNIQUE constraints that cause btree overflow#3
jakebromberg merged 1 commit intomainfrom
fix/remove-unique-constraints

Conversation

@jakebromberg
Copy link
Member

Summary

  • Remove UNIQUE (release_id, artist_name) from release_artist and UNIQUE (release_id, track_sequence, artist_name) from release_track_artist in create_database.sql
  • These constraints cause btree index overflow when artist_name exceeds ~900 bytes (PostgreSQL's 2,704-byte page limit)
  • The constraints are redundant: import_csv.py deduplicates rows via unique_key before COPY, and dedup_releases.py drops them during copy-swap anyway

Test plan

  • Unit tests pass (190/190)
  • Integration tests pass (pytest -m postgres) -- added test_no_unique_constraints_on_child_tables to verify constraints are absent
  • Re-run ETL import with previously-failing data (long artist names)

…st names

The btree index backing UNIQUE (release_id, artist_name) overflows
PostgreSQL's 2,704-byte limit when artist_name exceeds ~900 bytes.
These constraints are redundant: import_csv.py deduplicates via
unique_key before COPY, and dedup_releases.py drops them anyway
during copy-swap.
@jakebromberg jakebromberg merged commit 08de176 into main Feb 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant