From e20defeebd988ff4db62b75e3036b332da78e795 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 2 Dec 2020 22:18:27 +0100 Subject: [PATCH] avoid contains operator for geometries Postgis keeps messing up use of index in some circumstances. --- sql/functions/placex_triggers.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/functions/placex_triggers.sql b/sql/functions/placex_triggers.sql index ea9474e4..87f15e8c 100644 --- a/sql/functions/placex_triggers.sql +++ b/sql/functions/placex_triggers.sql @@ -97,7 +97,7 @@ BEGIN -- Instead simply use the containing area with the largest rank. FOR location IN SELECT place_id FROM placex - WHERE bbox @ geometry AND _ST_Covers(geometry, ST_Centroid(bbox)) + WHERE bbox && geometry AND _ST_Covers(geometry, ST_Centroid(bbox)) AND rank_address between 5 and 25 ORDER BY rank_address desc LOOP @@ -112,7 +112,7 @@ BEGIN -- contains the bbox, only use addressable features FOR location IN SELECT place_id FROM placex - WHERE bbox @ geometry AND _ST_Covers(geometry, ST_Centroid(bbox)) + WHERE bbox && geometry AND _ST_Covers(geometry, ST_Centroid(bbox)) AND rank_address between 5 and 25 ORDER BY rank_address desc LOOP -- 2.45.2