Skip to content

Commit

Permalink
Fix performance issue, affecting projinfo EPSG:7842
Browse files Browse the repository at this point in the history
Fixes OSGeo#1913

AuthorityFactory::createBetweenGeodeticCRSWithDatumBasedIntermediates() issued
a complex SQL query that pushes the SQLite3 query plan optimizer to its limits.
Was working reasonably with sqlite 3.11, but not with later versions.
So put less constraints in the main query and do post-processing checks and
auxiliary requests to avoid such issues.

For some unknown reason, this slightly slows down a bit execution time of the
whole test_cpp_api binary (~ 10%), but couldn't come with something better,
despite trying many variations of the main SQL query. It seems that in the
general case the non-filter LEFT JOIN on the supersession table helped,
except on this EPSG:7842 case.
  • Loading branch information
rouault committed Feb 6, 2020
1 parent d7cd772 commit 589c44a
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 105 deletions.
2 changes: 2 additions & 0 deletions data/sql/proj_db_table_defs.sql
Expand Up @@ -1364,6 +1364,8 @@ CREATE TABLE supersession(
source TEXT
);

CREATE INDEX idx_supersession ON supersession(superseded_table_name, superseded_auth_name, superseded_code);

CREATE TRIGGER supersession_insert_trigger
BEFORE INSERT ON supersession
FOR EACH ROW BEGIN
Expand Down

0 comments on commit 589c44a

Please sign in to comment.