-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmaintTables.sql
80 lines (69 loc) · 2.83 KB
/
maintTables.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--
-- assumes that address_t,address_s,address_o,address
-- have been created already.
--
--
-- updating the ttable field to point to address table
--
update pggeocoder.address_t set ttable = 'pggeocoder.address_c';
--
-- creating index for address_t
--
create index address_t1 on pggeocoder.address_t(todofuken);
create index address_t2 on pggeocoder.address_t(code);
--
-- creating index for address_s
--
create index address_s1 on pggeocoder.address_s(todofuken);
create index address_s2 on pggeocoder.address_s(shikuchoson);
create index address_s3 on pggeocoder.address_s(code);
create index address_s4 on pggeocoder.address_s(tr_shikuchoson);
--
-- creating index for address_o
--
create index address_o1 on pggeocoder.address_o(todofuken);
create index address_o2 on pggeocoder.address_o(shikuchoson);
create index address_o3 on pggeocoder.address_o(ooaza);
create index address_o4 on pggeocoder.address_o(code);
create index address_o5 on pggeocoder.address_o(tr_shikuchoson);
create index address_o6 on pggeocoder.address_o(tr_ooaza);
--
-- creating index for address_c
--
create index address_c1 on pggeocoder.address_c(todofuken);
create index address_c2 on pggeocoder.address_c(shikuchoson);
create index address_c3 on pggeocoder.address_c(ooaza);
create index address_c4 on pggeocoder.address_c(chiban);
create index address_c5 on pggeocoder.address_c(tr_shikuchoson);
create index address_c6 on pggeocoder.address_c(tr_ooaza);
--
-- creating index for address_g
--
create index address_g1 on pggeocoder.address_g(shikuchoson);
create index address_g2 on pggeocoder.address_g(ooaza);
create index address_g3 on pggeocoder.address_g(chiban);
create index address_g4 on pggeocoder.address_g(go);
create index address_g5 on pggeocoder.address_g(tr_ooaza);
create index address_g6 on pggeocoder.address_g(tr_shikuchoson);
create index address_g7 on pggeocoder.address_g using gist( geog );
--
-- for Reverse Geocoding
--
create index address_o_g_idx on pggeocoder.address_o using gist( geog );
create index address_g_idx on pggeocoder.address_c using gist( geog );
create index boundary_t1 on pggeocoder.boundary_t(todofuken);
create index boundary_t2 on pggeocoder.boundary_t(code);
create index boundary_t_g_idx on pggeocoder.boundary_t using gist( geom );
create index boundary_s1 on pggeocoder.boundary_s(todofuken);
create index boundary_s2 on pggeocoder.boundary_s(shikuchoson);
create index boundary_s3 on pggeocoder.boundary_s(code);
create index boundary_s_g_idx on pggeocoder.boundary_s using gist( geom );
create index boundary_o1 on pggeocoder.boundary_o(todofuken);
create index boundary_o2 on pggeocoder.boundary_o(shikuchoson);
create index boundary_o3 on pggeocoder.boundary_o(ooaza);
create index boundary_o4 on pggeocoder.boundary_o(code);
create index boundary_o_g_idx on pggeocoder.boundary_o using gist( geom );
--
-- Vacuuming everything
--
VACUUM FULL;