From c8a1ef6f68bdaaed62cf8f215a23b8ed3a3d5e0f Mon Sep 17 00:00:00 2001 From: Javier Goizueta Date: Tue, 22 Dec 2015 15:25:21 +0100 Subject: [PATCH] Slight optimization of gridded clustering --- scripts-available/CDB_Overviews.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts-available/CDB_Overviews.sql b/scripts-available/CDB_Overviews.sql index 5d94b09..203f797 100644 --- a/scripts-available/CDB_Overviews.sql +++ b/scripts-available/CDB_Overviews.sql @@ -193,14 +193,14 @@ AS $$ aggr_attributes := ''; EXECUTE Format('DROP TABLE IF EXISTS %s CASCADE;', overview_rel); - EXECUTE Format(' CREATE TABLE %3$s AS WITH clusters AS ( SELECT first_value(f.cartodb_id) OVER ( PARTITION BY - ST_SnapToGrid(f.the_geom_webmercator, 0, 0, %2$s, %2$s) + Floor(ST_X(f.the_geom_webmercator)/%2$s)::int, + Floor(ST_Y(f.the_geom_webmercator)/%2$s)::int ) AS cartodb_id, %4$s the_geom,