From: Regina Obe Date: Wed, 11 May 2011 13:50:05 +0000 (+0000) Subject: put in some missing indexes X-Git-Tag: 2.0.0alpha1~1678 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fcff5e7c344631e89c189919813d7ed614142dc3;p=postgis put in some missing indexes git-svn-id: http://svn.osgeo.org/postgis/trunk@7130 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/extras/tiger_geocoder/tiger_2010/tables/lookup_tables_2010.sql b/extras/tiger_geocoder/tiger_2010/tables/lookup_tables_2010.sql index 35ef02514..6c4e46d59 100644 --- a/extras/tiger_geocoder/tiger_2010/tables/lookup_tables_2010.sql +++ b/extras/tiger_geocoder/tiger_2010/tables/lookup_tables_2010.sql @@ -937,7 +937,7 @@ CREATE TABLE county CONSTRAINT enforce_geotype_geom CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL), CONSTRAINT enforce_srid_geom CHECK (st_srid(the_geom) = 4269) ); -CREATE INDEX idx_tiger_data_edges ON edges USING btree (countyfp); +CREATE INDEX idx_tiger_county ON county USING btree (countyfp); DROP TABLE IF EXISTS state; CREATE TABLE state @@ -991,6 +991,7 @@ CREATE TABLE place CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 'MULTIPOLYGON'::text OR the_geom IS NULL), CONSTRAINT enforce_srid_the_geom CHECK (st_srid(the_geom) = 4269) ); +CREATE INDEX tiger_place_the_geom_gist ON place USING gist(the_geom); DROP TABLE IF EXISTS zip_state; CREATE TABLE zip_state diff --git a/extras/tiger_geocoder/tiger_2010/tiger_loader.sql b/extras/tiger_geocoder/tiger_2010/tiger_loader.sql index f10f1372b..7d7ed793b 100644 --- a/extras/tiger_geocoder/tiger_2010/tiger_loader.sql +++ b/extras/tiger_geocoder/tiger_2010/tiger_loader.sql @@ -111,6 +111,7 @@ VALUES(3, 'place', 'place10', true, false, true,false, 'c', '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${table_name} PRIMARY KEY (plcidfp) ) INHERITS(place);" ', '${psql} -c "ALTER TABLE ${staging_schema}.${state_abbrev}_${table_name} RENAME geoid10 TO plcidfp;SELECT loader_load_staged_data(lower(''${state_abbrev}_${table_name}''), lower(''${state_abbrev}_${lookup_name}'')); ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT uidx_${state_abbrev}_${lookup_name}_gid UNIQUE (gid);" ${psql} -c "CREATE INDEX idx_${state_abbrev}_${lookup_name}_soundex_name ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (soundex(name));" +${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);" ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');"' ); @@ -129,8 +130,8 @@ VALUES(5, 'zcta5', 'zcta5', false, false, true,false, 'a', INSERT INTO loader_lookuptables(process_order, lookup_name, table_name, load, level_county, level_state, single_geom_mode, insert_mode, pre_load_process, post_load_process ) VALUES(6, 'faces', 'faces', true, true, false,false, 'c', - '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${lookup_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(${lookup_name});" ', - '${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${lookup_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);" + '${psql} -c "CREATE TABLE ${data_schema}.${state_abbrev}_${table_name}(CONSTRAINT pk_${state_abbrev}_${lookup_name} PRIMARY KEY (gid)) INHERITS(${lookup_name});" ', + '${psql} -c "CREATE INDEX ${data_schema}_${state_abbrev}_${table_name}_the_geom_gist ON ${data_schema}.${state_abbrev}_${lookup_name} USING gist(the_geom);" ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${lookup_name}_tfid ON ${data_schema}.${state_abbrev}_${lookup_name} USING btree (tfid);" ${psql} -c "CREATE INDEX idx_${data_schema}_${state_abbrev}_${table_name}_countyfp ON ${data_schema}.${state_abbrev}_${table_name} USING btree (countyfp);" ${psql} -c "ALTER TABLE ${data_schema}.${state_abbrev}_${lookup_name} ADD CONSTRAINT chk_statefp CHECK (statefp = ''${state_fips}'');" diff --git a/extras/tiger_geocoder/tiger_2010/upgrade_geocode.sql b/extras/tiger_geocoder/tiger_2010/upgrade_geocode.sql index 16f2e8fb2..acad1fc08 100644 --- a/extras/tiger_geocoder/tiger_2010/upgrade_geocode.sql +++ b/extras/tiger_geocoder/tiger_2010/upgrade_geocode.sql @@ -8,6 +8,7 @@ UPDATE state_lookup SET statefp = lpad(st_code::text,2,'0') WHERE statefp IS NUL ALTER TABLE state_lookup ADD CONSTRAINT state_lookup_statefp_key UNIQUE(statefp); CREATE INDEX idx_tiger_edges_countyfp ON edges USING btree(countyfp); CREATE INDEX idx_tiger_faces_countyfp ON faces USING btree(countyfp); +CREATE INDEX tiger_place_the_geom_gist ON place USING gist(the_geom); BEGIN; -- Type used to pass around a normalized address between functions