From: Sarah Hoffmann Date: Mon, 25 Oct 2021 12:55:15 +0000 (+0200) Subject: reverse: add index hints X-Git-Tag: v4.0.0~10^2 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/7bd9094aaa39d4be375a94111e41e7307b92c602?ds=inline;hp=-c reverse: add index hints The fairly complex where condition of idx_placex_geometry_placenode won't always be matched by the query planner if the condition part doesn't appear verbatim in the query. Fixes #2480. --- 7bd9094aaa39d4be375a94111e41e7307b92c602 diff --git a/lib-php/ReverseGeocode.php b/lib-php/ReverseGeocode.php index 47e931ef..a670c623 100644 --- a/lib-php/ReverseGeocode.php +++ b/lib-php/ReverseGeocode.php @@ -111,6 +111,7 @@ class ReverseGeocode $sSQL .= ' FROM placex'; $sSQL .= ' WHERE osm_type = \'N\''; $sSQL .= ' AND country_code = \''.$sCountryCode.'\''; + $sSQL .= ' AND rank_search < 26 '; // needed to select right index $sSQL .= ' AND rank_search between 5 and ' .min(25, $iMaxRank); $sSQL .= ' AND class = \'place\' AND type != \'postcode\''; $sSQL .= ' AND name IS NOT NULL '; @@ -206,6 +207,7 @@ class ReverseGeocode // for place nodes at rank_address 16 $sSQL .= ' AND rank_search > '.$iRankSearch; $sSQL .= ' AND rank_search <= '.$iMaxRank; + $sSQL .= ' AND rank_search < 26 '; // needed to select right index $sSQL .= ' AND rank_address > 0'; $sSQL .= ' AND class = \'place\''; $sSQL .= ' AND type != \'postcode\'';