create database monitor;

create user 'monitor'@'localhost' identified by 'monitor';
grant all on monitor.* to 'monitor'@'localhost';
grant all on monitor.* to 'monitor';

use monitor; 

drop table if exists query_input;
CREATE TABLE query_input
(
    query_master_id        BIGINT,
    status                 varchar(20),
    panels                 int,
    items                  int
);

alter table query_input add index (query_master_id);
alter table query_input add index (status);


drop table if exists panel_input;
CREATE TABLE panel_input
(
    query_master_id        BIGINT,
    panel                  int,
    item_key               varchar(1024)
);


-- mirrors node_output.csv
drop table if exists node_output;
CREATE TABLE node_output
(
    query_master_id        BIGINT,
    node_id                varchar(10),
    set_size               int,
    start_time             varchar(30), 
    end_time               varchar(30)
);

alter table node_output add index (query_master_id);
alter table node_output add index (node_id);
alter table node_output add index (set_size);
