Repository navigation
Conversation
Six plain indexes from t.references repeat the leading column of a unique index on the same table. Every insert and delete updated both b-trees, and the unique index serves the same queries. The new migration drops them and keeps the unique indexes. dead_letters.retried_message_id has a foreign key with ON DELETE SET NULL, but SQLite and PostgreSQL had no index on it. Each deleted message caused a scan of dead_letters, so pruning slowed as dead letters accumulated. The migration adds idx_so_dead_letters_retried_message when no index on that column exists. MySQL already has one for the foreign key, so it gets no second index. A schema test fails on a plain index that repeats the leading columns of a unique index. Its allowlist names the two known indexes on messages and reminders. A migration test reverts and applies the migration again on the database under test, and checks that each MySQL foreign key keeps a covering index. Refs #115
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR removes six duplicate plain indexes and adds an index on
No actionable issues found. Tests were not run during this review. Reviews (1) · Last reviewed commit: "perf: drop redundant indexes and index r..." · Reviewed by Greptile |
|
Docs7 for cardmagic/solid-objects-ruby
Commit |
Owner
Author
|
Duplicate of #116, which already merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applications that run Solid Objects on SQLite, PostgreSQL, or MySQL, and the message pruner that deletes old messages, are affected. A new migration that can be reversed drops six duplicate plain indexes and adds an index on
dead_letters.retried_message_id. The change is in the new migration indb/migrate, two new schema tests undertest/models, andCHANGELOG.md.The change takes effect when an existing install copies and runs the migration, or when a new install applies the full migration set. Each insert and delete updated two indexes for one access path, and each deleted message caused a scan of
dead_letterson SQLite and PostgreSQL.Verification: The new tests passed on SQLite, PostgreSQL,
mysql2, andtrilogy, and the full suites failed only on one macOS-only gem type-check test that does not use the schema.Related: #115