· 7 years ago · Feb 26, 2019, 06:56 AM
1CREATE flat_table(
2 trip_id integer,
3 tstamp timestamptz,
4 speed float,
5 distance float,
6 temperature float,
7 ,...);
8
9CREATE trips(
10 trip_id integer,
11 other_info text);
12
13CREATE tstamps(
14 tstamp_id integer,
15 tstamp timestamptz);
16
17CREATE meas_facts(
18 trip_id integer,
19 tstamp_id integer,
20 speed float,
21 distance float,
22 temperature float,
23 ,...);
24
25CREATE speed_facts(
26 trip_id integer,
27 tstamp_id integer,
28 speed float);
29
30CREATE distance_facts(
31 trip_id integer,
32 tstamp_id integer,
33 distance float);
34
35CREATE uber_table(
36 trip_id integer,
37 tstart timestamptz,
38 speed float[],
39 distance float[],
40 temperature float[],
41 ,...);
42
43CREATE uber_table(
44 trip_id integer,
45 speed hstore,
46 distance hstore,
47 temperature hstore,
48 ,...);
49
50CREATE TABLE IF NOT EXISTS trip (
51 ts TIMESTAMPTZ NOT NULL PRIMARY KEY,
52 speed REAL NOT NULL,
53 distance REAL NOT NULL,
54 temperature REAL NOT NULL
55)