Last change
on this file since 26899 was 26899, checked in by davidb, 11 years ago |
Tipple reborn after Chris's Summer of Code 2013
|
File size:
775 bytes
|
Line | |
---|
1 | -- This script creates a function and indexes that allow osmosis to efficiently query based on transaction ids.
|
---|
2 | CREATE OR REPLACE FUNCTION xid_to_int4(t xid)
|
---|
3 | RETURNS integer AS
|
---|
4 | $BODY$
|
---|
5 | DECLARE
|
---|
6 | tl bigint;
|
---|
7 | ti int;
|
---|
8 | BEGIN
|
---|
9 | tl := t;
|
---|
10 |
|
---|
11 | IF tl >= 2147483648 THEN
|
---|
12 | tl := tl - 4294967296;
|
---|
13 | END IF;
|
---|
14 |
|
---|
15 | ti := tl;
|
---|
16 |
|
---|
17 | RETURN ti;
|
---|
18 | END;
|
---|
19 | $BODY$
|
---|
20 | LANGUAGE 'plpgsql' IMMUTABLE STRICT;
|
---|
21 |
|
---|
22 |
|
---|
23 | DROP INDEX IF EXISTS nodes_xmin_idx;
|
---|
24 | DROP INDEX IF EXISTS ways_xmin_idx;
|
---|
25 | DROP INDEX IF EXISTS relations_xmin_idx;
|
---|
26 | CREATE INDEX nodes_xmin_idx ON nodes USING btree ((xid_to_int4(xmin)));
|
---|
27 | CREATE INDEX ways_xmin_idx ON ways USING btree ((xid_to_int4(xmin)));
|
---|
28 | CREATE INDEX relations_xmin_idx ON relations USING btree ((xid_to_int4(xmin)));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.