Repository navigation
Conversation
… index Until the parent path index is valid, the queries relying on it read the whole item table: deploying the code while the index is still being built overloads the database. On large databases the index is thus created by hand before the release, and the migration failed on its name. The migration now skips the build when a valid index exists. An invalid one, left behind by an interrupted concurrent build, also made it fail: it is dropped and built again. The operation doing so is not tied to this index, for the next migrations building one concurrently to reuse it.
NathanVss
force-pushed
the
fix/item-parent-path-idx-migration
branch
from
October 9, 2026 16:28
4c7f55b to
ec12209
Compare
|
This branch has not been deployed
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.



Purpose
Until
item_parent_path_idxis valid, the queries relying on it read the whole item table. On preprod the new code served requests while the index was still being built: item creation took 17s and the migration job died after 33 minutes, leaving an invalid index.On large databases the index must therefore be created by hand before the release is deployed, but the migration then fails with
relation "item_parent_path_idx" already exists.Proposal
Migration
0031now uses a reusableAddIndexConcurrentlyIfMissingoperation (core/utils/migrations.py), which looks the index up before building it:Deploying on a large database
Before deploying, run and check that
indisvalidis true: