begin; create table geoname.country_shape ( geonameid bigint primary key, shape geometry ); INSERT INTO geoname.country_shape SELECT g.geonameid::bigint, shape FROM geoname.country_shape_raw g; create index on geoname.country_shape using gist(shape); commit;