From aa2545bebddec14caf4bae8e7615dbb880613faa Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Wed, 5 Feb 2020 17:59:55 +0100 Subject: Fix performance issue, affecting projinfo EPSG:7842 Fixes #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. --- test/unit/test_crs.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/unit/test_crs.cpp') diff --git a/test/unit/test_crs.cpp b/test/unit/test_crs.cpp index 87efc59d..66bfbfcd 100644 --- a/test/unit/test_crs.cpp +++ b/test/unit/test_crs.cpp @@ -5197,6 +5197,18 @@ TEST(crs, crs_createBoundCRSToWGS84IfPossible) { dbContext, CoordinateOperationContext::IntermediateCRSUse::NEVER); EXPECT_EQ(bound, crs); } + { + // GDA2020 geocentric + auto crs = factory->createCoordinateReferenceSystem("7842"); + const auto time_before = + ::testing::UnitTest::GetInstance()->elapsed_time(); + crs->createBoundCRSToWGS84IfPossible( + dbContext, CoordinateOperationContext::IntermediateCRSUse:: + IF_NO_DIRECT_TRANSFORMATION); + const auto time_after = + ::testing::UnitTest::GetInstance()->elapsed_time(); + EXPECT_LE(time_after - time_before, 500); + } } // --------------------------------------------------------------------------- -- cgit v1.2.3