From f017e1e9a100116731d887e6c2753b24630b55d6 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 25 Sep 2022 14:09:45 +0200 Subject: [PATCH] make sure indexes are used --- lib-sql/functions/placex_triggers.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib-sql/functions/placex_triggers.sql b/lib-sql/functions/placex_triggers.sql index b32cf0f5..a2276f07 100644 --- a/lib-sql/functions/placex_triggers.sql +++ b/lib-sql/functions/placex_triggers.sql @@ -849,7 +849,8 @@ BEGIN FROM placex WHERE osm_type = 'R' and class = 'boundary' and type = 'administrative' and admin_level < NEW.admin_level and admin_level > 3 - and rank_address > 0 + and rank_address between 1 and 25 -- for index selection + and ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') -- for index selection and geometry && NEW.centroid and _ST_Covers(geometry, NEW.centroid) ORDER BY admin_level desc LIMIT 1 LOOP -- 2.45.1