-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mssql] Use Filter instead of STIntersects to improve query performance
...and refine validity test from 57dc3c7 Using Filter is more performant since it does a bounding box only check when an appropriate spatial index is available. This matches the behavior with other providers, where the provider filter only does a bounding box check and callers must perform the actual intersection check if required. While Filter also avoids SQL server closing the iterator upon encountering invalid geometries, we can't rely on this because SQL server will transparently fall back to STIntersects if it decides there's no suitable spatial indexes available, and then throw an exception on invalid geometries. So we still require the STISValid check when using Filter. The extent calculation from 57dc3c7 has been refined to avoid the very expensive STMakeValid call. Instead we use a (ugly!) workaround to skip invalid geometries using STIsValid only inside the min/max x/y aggregates. Note that we can't just dump a WHERE STIsValid clause in to the statement because SQL server still throws the exception. Gotta love it! Fix #15752, #10947
- Loading branch information
1 parent
039866d
commit 62af54e
Showing
3 changed files
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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