Commit b557347a authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci

database: Replanning the database and its data marts 18

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parent 1aa2db45
......@@ -222,9 +222,7 @@ comment on table dm_alert_city_history is 'Data mart table with the history of
alerts per city and month';
/* -------------------------------------------------------------------------- */
/* Network usage tables
* Brazil, regions, states, cities and schools levels?
* Yearly usage, monthly usage, weekly usage, daily usage? */
/* Network usage tables */
create table dm_net_usage_state (
region varchar(12) not null,
......
......@@ -45,14 +45,15 @@ create table dim_time (
comment on table dim_time is 'Dimension table with collect times during a day';
create table dim_school (
id integer primary key,
inep varchar(12) unique not null,
region varchar(12) not null,
state varchar(2) not null,
city varchar(50) not null, /* Longest city name has 32 characters */
school varchar(100) not null, /* MEC web service limit for school names */
code varchar(8),
address varchar(100) /* Longest address has 70 characters */
id integer primary key,
inep varchar(12) unique not null,
region varchar(12) not null,
state varchar(2) not null,
city varchar(50) not null, /* Longest city name has 32 characters */
school varchar(100) not null, /* MEC web service limit for school names */
code varchar(8),
address varchar(100), /* Longest address has 70 characters */
net_data boolean default false not null
);
comment on table dim_school is 'Dimension table with data about the schools';
......@@ -178,26 +179,13 @@ comment on table fact_alert is 'Fact table with the history of machines
modifications';
create table fact_net_usage (
--id serial primary key,
date_id integer references dim_date,
time_id integer references dim_time,
machine_id integer references dim_machine
down_packages integer not null,
down_bytes bigint not null,
up_packages integer not null,
up_bytes bigint not null
);
comment on table fact_net_usage is 'Fact table with machines network usage';
/* Is this table needed, or the data mart is enough?
create table fact_net_usage_school (
school_id integer references dim_school,
collect_date date references dim_date,
time_id integer references dim_time,
school_id integer references dim_school,
down_packages integer not null,
down_bytes bigint not null,
up_packages integer not null,
up_bytes bigint not null
);
/*comment on table fact_net_usage_school is 'Fact table with the history of
network usage per school';*/
comment on table fact_net_usage is 'Fact table with the history of network usage
per school';
......@@ -19,6 +19,9 @@
* USA.
*/
create index on dim_school (region, state, city);
create index on fact_net_usage (school_id, collect_date);
create index on dm_avail_state_history (contact_date desc);
create index on dm_avail_city_history (contact_date desc);
create index on dm_invent_machine (state, city);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment