Created
October 15, 2018 20:32
-
-
Save Rub21/59c288447992a6522b631dee96904c96 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@usa-db-0:~# wget https://raw.githubusercontent.com/openstreetmap/osmosis/master/package/script/contrib/apidb_0.6_osmosis_xid_indexing.sql | |
--2018-10-15 17:15:52-- https://raw.githubusercontent.com/openstreetmap/osmosis/master/package/script/contrib/apidb_0.6_osmosis_xid_indexing.sql | |
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.200.133 | |
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.200.133|:443... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 775 [text/plain] | |
Saving to: ‘apidb_0.6_osmosis_xid_indexing.sql’ | |
apidb_0.6_osmosis_xid_indexing.sql 100%[===============================================================================================>] 775 --.-KB/s in 0s | |
2018-10-15 17:15:52 (41.7 MB/s) - ‘apidb_0.6_osmosis_xid_indexing.sql’ saved [775/775] | |
root@usa-db-0:~# ls | |
apidb_0.6_osmosis_xid_indexing.sql | |
root@usa-db-0:~# | |
root@usa-db-0:~# psql -U postgres -d openstreetmap -a -f drop_indexes.sql | |
drop_indexes.sql: No such file or directory | |
root@usa-db-0:~# psql -U postgres -d openstreetmap -a -f apidb_0.6_osmosis_xid_indexing.sql | |
-- This script creates a function and indexes that allow osmosis to efficiently query based on transaction ids. | |
CREATE OR REPLACE FUNCTION xid_to_int4(t xid) | |
RETURNS integer AS | |
$BODY$ | |
DECLARE | |
tl bigint; | |
ti int; | |
BEGIN | |
tl := t; | |
IF tl >= 2147483648 THEN | |
tl := tl - 4294967296; | |
END IF; | |
ti := tl; | |
RETURN ti; | |
END; | |
$BODY$ | |
LANGUAGE 'plpgsql' IMMUTABLE STRICT; | |
CREATE FUNCTION | |
DROP INDEX IF EXISTS nodes_xmin_idx; | |
psql:apidb_0.6_osmosis_xid_indexing.sql:23: NOTICE: index "nodes_xmin_idx" does not exist, skipping | |
DROP INDEX | |
DROP INDEX IF EXISTS ways_xmin_idx; | |
psql:apidb_0.6_osmosis_xid_indexing.sql:24: NOTICE: index "ways_xmin_idx" does not exist, skipping | |
DROP INDEX | |
DROP INDEX IF EXISTS relations_xmin_idx; | |
psql:apidb_0.6_osmosis_xid_indexing.sql:25: NOTICE: index "relations_xmin_idx" does not exist, skipping | |
DROP INDEX | |
CREATE INDEX nodes_xmin_idx ON nodes USING btree ((xid_to_int4(xmin))); | |
psql:apidb_0.6_osmosis_xid_indexing.sql:26: ERROR: index creation on system columns is not supported | |
CREATE INDEX ways_xmin_idx ON ways USING btree ((xid_to_int4(xmin))); | |
psql:apidb_0.6_osmosis_xid_indexing.sql:27: ERROR: index creation on system columns is not supported | |
CREATE INDEX relations_xmin_idx ON relations USING btree ((xid_to_int4(xmin))); | |
psql:apidb_0.6_osmosis_xid_indexing.sql:28: ERROR: index creation on system columns is not supported |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment