Skip to content

Commit 9ad3767

Browse files
committed
Update SQL migration for council district project distribution analytics view
This commit modifies the migration files by adding an index for improved performance on the `layer_council_district` table and includes a rollback command to drop the index if it exists. These changes enhance the efficiency of querying project distributions by council district.
1 parent dfcca94 commit 9ad3767

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

  • moped-database/migrations/default/1758551918596_adjust-projects-per-district-view

moped-database/migrations/default/1758551918596_adjust-projects-per-district-view/down.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
DROP INDEX IF EXISTS idx_council_district_geom_2277;
2+
3+
14
CREATE OR REPLACE VIEW council_district_project_distribution_analytics AS WITH area_project_buffers AS (
25
SELECT
36
projects.project_id,

moped-database/migrations/default/1758551918596_adjust-projects-per-district-view/up.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ SELECT
4343
FROM area_district_aggregates AS ada
4444
INNER JOIN project_totals AS pt ON ada.project_id = pt.project_id
4545
ORDER BY ada.project_id, ada.council_district_id;
46+
47+
48+
CREATE INDEX IF NOT EXISTS idx_council_district_geom_2277
49+
ON layer_council_district USING gist (st_transform(geography::geometry, 2277));

0 commit comments

Comments
 (0)