Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not reindex concurrently on PG < v16 #71

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Conversation

andyundso
Copy link
Member

Fixes #67

System tables in database cannot be re-indexed concurrently on PG v15 and below. This PR switches to the reindexdb command provided by Postgres to start the reindex operation, and depending on the version, activates CONCURRENTLY or not.

Without CONCURRENTLY, Postgres locks the database during the INDEX operation. I added an information about that to the README.

@andyundso andyundso requested a review from justinclift December 9, 2024 15:09
@justinclift
Copy link
Member

Awesome, this seems like a good approach. 😄

The only thing that stands out as a bit unusual to me is the use of bc and a subshell for the value comparison:

$(echo "15 <= $PGTARGET" | bc)

Wouldn't the more standard "$PGTARGET" -le 15 do the same thing and not need bc installed?

@andyundso
Copy link
Member Author

I am not the greatest bash programmer, but I am learning :)

removed bc and adjusted the version check according to your suggestion @justinclift in the latest commit.

@justinclift
Copy link
Member

Cool, that looks good. 😄

@justinclift justinclift merged commit 0c38e35 into main Dec 10, 2024
26 checks passed
@justinclift justinclift deleted the older-pg-reindex branch December 10, 2024 14:21
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.

REINDEX fails
2 participants