This repository was archived by the owner on May 19, 2020. It is now read-only.
Added parallel safe keyword to function definitions #1
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.
Since Postgres 9.6 the
PARALLEL SAFEmodifiers for function definition enables the execution of queries using one or more workers in parallel (more details here).This straight forward PR adds this modifier to this repo functions to avoid them potentially blocking parallel execution when present.
I've done tests on all functions to ensure they don't block parallel executions with the following procedure:
postgres:12Docker container with Postgis 3 installedpointswith 1M random points and a randomkpiinteger columnne_10m_admin_1_states_provincesfrom Natural Earth to have also a multipolygon tableThe tests below shared are just meant to showcase that
PARALLEL SAFEcan help the faster execution of queries and is not an indicator of the improvement introduced since there are many factors that can affect that.It's worth noting that this makes these functions only available for Postgres 9.6 onwards so maybe we could consider having both versions in separated folders. Let me know if that would make sense to modify the PR that way.
Query examples
For each query, the execution time in milliseconds with and without the
PARALLEL SAFEkeyword is shared.MakeArc
MercBuffer
MercDWithin
MercLength
OrientedEnvelope
Sieve
SmartShrink
TileBBox
ToPoint