From e66889e2b2512b028551e19e12a9103eae176d09 Mon Sep 17 00:00:00 2001 From: Adrian 'Nexces' Piotrowicz Date: Mon, 21 Oct 2019 06:39:27 +0200 Subject: [PATCH] Apply bbox to part of "addresses" query Adding parenthesis around additional conditions allows to use index and prevents from selecting all rows from DB containing "addr:housename" or "addr:unit". --- project.mml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.mml b/project.mml index cf9d1559b1..9a296d19c6 100644 --- a/project.mml +++ b/project.mml @@ -2097,7 +2097,7 @@ Layer: tags->'addr:unit' AS addr_unit, NULL AS way_pixels FROM planet_osm_point - WHERE way && !bbox! AND ("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR ((tags->'addr:unit') IS NOT NULL) + WHERE way && !bbox! AND (("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR ((tags->'addr:unit') IS NOT NULL)) ORDER BY way_pixels DESC NULLS LAST ) AS addresses properties: