Split indexing further, UPRN requires bigint
This commit is contained in:
parent
bddd7e769f
commit
3f9c9f3221
@ -22,4 +22,6 @@ The scripts should be run in the following order:
|
||||
1. filter_transform_mastermap_for_loading.sh
|
||||
1. load_geometries.sh
|
||||
1. create_building_records.sh
|
||||
1. (SQL migration) psql < ../migrations/002.index-geometries.sql
|
||||
1. load_uprns.py
|
||||
1. (SQL migration) psql < ../migrations/002.index-buildings.sql
|
||||
|
@ -20,6 +20,8 @@ CREATE TABLE geometries (
|
||||
CREATE TABLE buildings (
|
||||
-- internal unique id
|
||||
building_id serial PRIMARY KEY,
|
||||
-- unique property reference number
|
||||
uprn bigint,
|
||||
-- jsonb document for all data, attributes to be specified in application
|
||||
building_doc jsonb,
|
||||
-- reference to geometry, aiming to decouple from geometry provider
|
||||
@ -104,6 +106,6 @@ CREATE TABLE logs (
|
||||
building_id integer REFERENCES buildings
|
||||
);
|
||||
|
||||
CREATE INDEX log_timestamp_idx ON log ( log_timestamp );
|
||||
CREATE INDEX log_user_idx ON log ( user_id );
|
||||
CREATE INDEX log_building_idx ON log ( building_id );
|
||||
CREATE INDEX log_timestamp_idx ON logs ( log_timestamp );
|
||||
CREATE INDEX log_user_idx ON logs ( user_id );
|
||||
CREATE INDEX log_building_idx ON logs ( building_id );
|
||||
|
@ -1,7 +0,0 @@
|
||||
-- Create indexes after bulk loading geometries and building records
|
||||
|
||||
-- Spatial index over building outlines
|
||||
CREATE INDEX geometries_idx ON geometries USING GIST ( geometry_geom );
|
||||
|
||||
-- Index over building geometry (expect to look up building by geometry_id)
|
||||
CREATE INDEX building_geometry_idx ON buildings ( geometry_id );
|
10
migrations/002.index-geometries.up.sql
Normal file
10
migrations/002.index-geometries.up.sql
Normal file
@ -0,0 +1,10 @@
|
||||
-- Create indexes after bulk loading geometries and building records
|
||||
|
||||
-- Spatial index over geometries
|
||||
CREATE INDEX geometries_idx ON geometries USING GIST ( geometry_geom );
|
||||
|
||||
-- Source ID index over geometries
|
||||
CREATE INDEX geometries_source_idx ON geometries ( source_id );
|
||||
|
||||
-- Index over building geometry_id (expect to look up building by geometry_id for map tiles)
|
||||
CREATE INDEX building_geometry_idx ON buildings ( geometry_id );
|
4
migrations/003.index-buildings.up.sql
Normal file
4
migrations/003.index-buildings.up.sql
Normal file
@ -0,0 +1,4 @@
|
||||
-- Create building indexes after bulk loading
|
||||
|
||||
-- UPRN index over buildings
|
||||
CREATE INDEX building_uprn_idx ON buildings ( uprn );
|
Loading…
Reference in New Issue
Block a user