Merge pull request #436 from lonvia/remove-location-property-tables

remove unused location_property_-partion- tables
This commit is contained in:
Sarah Hoffmann 2016-04-24 16:05:10 +02:00
commit 131527bdab
4 changed files with 3 additions and 28 deletions

View File

@ -19,10 +19,6 @@ CREATE INDEX idx_location_area_country_place_id ON location_area_country USING B
CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST (centroid) {ts:address-index}; CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST (centroid) {ts:address-index};
-- start
CREATE INDEX idx_location_property_-partition-_centroid ON location_property_-partition- USING GIST (centroid) {ts:address-index};
-- end
DROP INDEX IF EXISTS place_id_idx; DROP INDEX IF EXISTS place_id_idx;
CREATE UNIQUE INDEX idx_place_osm_unique on place using btree(osm_id,osm_type,class,type) {ts:address-index}; CREATE UNIQUE INDEX idx_place_osm_unique on place using btree(osm_id,osm_type,class,type) {ts:address-index};

View File

@ -51,11 +51,6 @@ CREATE INDEX idx_search_name_-partition-_place_id ON search_name_-partition- USI
CREATE INDEX idx_search_name_-partition-_centroid ON search_name_-partition- USING GIST (centroid) {ts:address-index}; CREATE INDEX idx_search_name_-partition-_centroid ON search_name_-partition- USING GIST (centroid) {ts:address-index};
CREATE INDEX idx_search_name_-partition-_name_vector ON search_name_-partition- USING GIN (name_vector) WITH (fastupdate = off) {ts:address-index}; CREATE INDEX idx_search_name_-partition-_name_vector ON search_name_-partition- USING GIN (name_vector) WITH (fastupdate = off) {ts:address-index};
CREATE TABLE location_property_-partition- () INHERITS (location_property) {ts:aux-data};
CREATE INDEX idx_location_property_-partition-_place_id ON location_property_-partition- USING BTREE (place_id) {ts:aux-index};
CREATE INDEX idx_location_property_-partition-_parent_place_id ON location_property_-partition- USING BTREE (parent_place_id) {ts:aux-index};
CREATE INDEX idx_location_property_-partition-_housenumber_parent_place_id ON location_property_-partition- USING BTREE (parent_place_id, housenumber) {ts:aux-index};
CREATE TABLE location_road_-partition- ( CREATE TABLE location_road_-partition- (
partition integer, partition integer,
place_id BIGINT, place_id BIGINT,

View File

@ -173,6 +173,8 @@ def db_template_setup():
psycopg2.extras.register_hstore(conn, globally=False, unicode=True) psycopg2.extras.register_hstore(conn, globally=False, unicode=True)
cur = conn.cursor() cur = conn.cursor()
for table in ('gb_postcode', 'us_postcode'): for table in ('gb_postcode', 'us_postcode'):
cur.execute("select * from pg_tables where tablename = '%s'" % (table, ))
if cur.rowcount > 0:
cur.execute('TRUNCATE TABLE %s' % (table,)) cur.execute('TRUNCATE TABLE %s' % (table,))
conn.commit() conn.commit()
conn.close() conn.close()

View File

@ -621,14 +621,6 @@
{ {
echo "Search indices\n"; echo "Search indices\n";
$bDidSomething = true; $bDidSomething = true;
$oDB =& getDB();
$sSQL = 'select distinct partition from country_name';
$aPartitions = $oDB->getCol($sSQL);
if (PEAR::isError($aPartitions))
{
fail($aPartitions->getMessage());
}
if (!$aCMDResult['no-partitions']) $aPartitions[] = 0;
$sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql'); $sTemplate = file_get_contents(CONST_BasePath.'/sql/indices.src.sql');
$sTemplate = replace_tablespace('{ts:address-index}', $sTemplate = replace_tablespace('{ts:address-index}',
@ -637,16 +629,6 @@
CONST_Tablespace_Search_Index, $sTemplate); CONST_Tablespace_Search_Index, $sTemplate);
$sTemplate = replace_tablespace('{ts:aux-index}', $sTemplate = replace_tablespace('{ts:aux-index}',
CONST_Tablespace_Aux_Index, $sTemplate); CONST_Tablespace_Aux_Index, $sTemplate);
preg_match_all('#^-- start(.*?)^-- end#ms', $sTemplate, $aMatches, PREG_SET_ORDER);
foreach($aMatches as $aMatch)
{
$sResult = '';
foreach($aPartitions as $sPartitionName)
{
$sResult .= str_replace('-partition-', $sPartitionName, $aMatch[1]);
}
$sTemplate = str_replace($aMatch[0], $sResult, $sTemplate);
}
pgsqlRunScript($sTemplate); pgsqlRunScript($sTemplate);
} }