-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(server): prevent duplicate geodata temp table #18580
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
Conversation
| CREATE INDEX IDX_geodata_gist_earthcoord | ||
| ON geodata_places | ||
| USING gist (ll_to_earth_public(latitude, longitude)) | ||
| WITH (fillfactor = 100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fillfactor param is lost in this PR, does that matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's intentionally removed because it only makes sense to have it if there are no inserts to the index after its creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also WITH (fillfactor = 100) can be omitted because it's the default in all Postgres versions.
100 (complete packing) is the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table fill factor is 100, but the index fill factor is lower. Setting the index fill factor to 100 only makes sense if the index data is completely static.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. Thanks for the correction!
Proper link instead of what I posted before: https://www.postgresql.org/docs/current/sql-createindex.html#INDEX-RELOPTION-FILLFACTOR
B-trees use a default fillfactor of 90
|
I'll take a look at this on Tuesday. I'm sure I made a migration to drop the tmp tables if they existed. |
|
This should be impossible
|
#17914
|
Interesting observation, perhaps we should specifically block downgrades after migrations are applied without also rolling back your database 🤔 |
drop tmp table, create gist index first
Description
It seems it's possible for the tmp table to exist in some cases, possibly when upgrading from older versions. This PR ensures the table is dropped before continuing.
Also moves one of the indices to be created before ingestion as it is noticeably faster in this case.