Repository navigation
Fix intermittent failure in the person search index plan test - #236
Merged
Merged
Conversation
The GIN index plan test only analyzed person_search after inserting 12,000 fixture people. If autovacuum had analyzed person earlier while it was small, the planner still believed person held a handful of rows, drove the join from a sequential scan of person and never used the GIN index. That made the integration suite fail intermittently on main. Analyzing both tables makes the plan depend on the fixture data, not on autovacuum timing.
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.
The main branch CI run after #232 failed in
tests/integration/db/postgresSearch.spec.ts("uses the GIN document index for selective prefixes on representative data"): the plan showed a sequential scan ofpersonestimated at 5 rows joined toperson_searchby primary key, soidx_person_search_documentnever appeared.Cause: the test inserts 12,000 people but only analyzes
person_search. When autovacuum has already analyzedpersonwhile it was small, the planner keeps the stale row estimate and prefers driving fromperson. I reproduced this locally by analyzingpersonbefore the insert (the test then fails every time) and confirmed that analyzing both tables after the insert makes it pass.Validated against a throwaway PostgreSQL 17 instance: the full integration suite passes (182 tests).