-
-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
The articles table currently uses id TEXT NOT NULL PRIMARY KEY where the value is the external service ID (e.g. Feedbin entry ID). This has downsides for join performance and index size compared to integer primary keys.
Current state
articles.idisTEXT— stores the external service ID directly- All child tables reference this text ID (
article_statuses.article_id,saved_search_articles.article_id,enclosures.article_id, etc.) - Joins across these tables use text comparison
Proposed changes
- Add an
INTEGER PRIMARY KEY AUTOINCREMENTcolumn as the true PK - Keep the external ID as
external_article_id TEXT NOT NULL UNIQUE - Update child table FKs to reference the integer PK
- Update queries and mappers accordingly
Benefits
- SQLite
INTEGER PRIMARY KEYis an alias forrowid, giving optimal storage and lookup - Smaller index footprint on child tables (8-byte int vs variable-length text)
- Cleaner separation between internal identity and external service IDs
Notes
- This is a significant migration — needs a new table + data copy approach since SQLite doesn't support altering PKs
- All account delegates and query files will need updates
- Should be coordinated with Enable SQLite foreign key enforcement #1787 (foreign key enforcement)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels