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

database: Replanning the database and its data marts 19

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parent b557347a
......@@ -24,7 +24,7 @@
create type classification as enum (
'green', /* Communication ocurred at most 10 days ago */
'yellow', /* Communication ocurred between 10 and 30 days */
'red' /* Communication doesn't occure for more than 30 days */
'red' /* Communication hasn't occured for more than 30 days */
);
/* -------------------------------------------------------------------------- */
......@@ -222,7 +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 */
/* Network usage tables with 5 minutes sample */
create table dm_net_usage_state (
region varchar(12) not null,
......@@ -253,6 +253,7 @@ create table dm_net_usage_school (
city varchar(50) not null,
inep varchar(10) not null,
school varchar(100) not null,
collect_date date not null,
collect_time timestamp not null,
down_packages integer not null,
down_bytes bigint not null,
......
......@@ -180,7 +180,7 @@ modifications';
create table fact_net_usage (
school_id integer references dim_school,
collect_date date references dim_date,
date_id date references dim_date,
time_id integer references dim_time,
down_packages integer not null,
down_bytes bigint not null,
......@@ -188,4 +188,4 @@ create table fact_net_usage (
up_bytes bigint not null
);
comment on table fact_net_usage is 'Fact table with the history of network usage
per school';
per school and 5 minutes sample';
......@@ -44,6 +44,7 @@ grant select on dim_processor to ${user};
grant select on dim_memory to ${user};
grant select on dim_hd to ${user};
grant select on dim_machine to ${user};
grant select on fact_availability to ${user};
grant select on fact_alert to ${user};
grant select on fact_net_usage to ${user};
......
......@@ -19,8 +19,8 @@
* USA.
*/
create index on dim_school (region, state, city);
create index on fact_net_usage (school_id, collect_date);
--create index on dim_school (region, state, city);
--create index on fact_net_usage (school_id, date_id);
create index on dm_avail_state_history (contact_date desc);
create index on dm_avail_city_history (contact_date desc);
......@@ -29,3 +29,4 @@ create index on dm_audit_zm_school (state, city);
create index on dm_alert_machine (state, city);
create index on dm_alert_state_history (contact_date desc);
create index on dm_alert_city_history (contact_date desc);
create index on dm_net_usage_school (inep, collect_date);
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