text: create table IF NOT EXISTS ts_metrics_2016_01_01 (check (created >= TIMESTAMP '2016-01-01 00:00:00-00' and created < TIMESTAMP '2016-01-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_02 (check (created >= TIMESTAMP '2016-01-02 00:00:00-00' and created < TIMESTAMP '2016-01-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_03 (check (created >= TIMESTAMP '2016-01-03 00:00:00-00' and created < TIMESTAMP '2016-01-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_04 (check (created >= TIMESTAMP '2016-01-04 00:00:00-00' and created < TIMESTAMP '2016-01-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_05 (check (created >= TIMESTAMP '2016-01-05 00:00:00-00' and created < TIMESTAMP '2016-01-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_06 (check (created >= TIMESTAMP '2016-01-06 00:00:00-00' and created < TIMESTAMP '2016-01-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_07 (check (created >= TIMESTAMP '2016-01-07 00:00:00-00' and created < TIMESTAMP '2016-01-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_08 (check (created >= TIMESTAMP '2016-01-08 00:00:00-00' and created < TIMESTAMP '2016-01-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_09 (check (created >= TIMESTAMP '2016-01-09 00:00:00-00' and created < TIMESTAMP '2016-01-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_10 (check (created >= TIMESTAMP '2016-01-10 00:00:00-00' and created < TIMESTAMP '2016-01-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_11 (check (created >= TIMESTAMP '2016-01-11 00:00:00-00' and created < TIMESTAMP '2016-01-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_12 (check (created >= TIMESTAMP '2016-01-12 00:00:00-00' and created < TIMESTAMP '2016-01-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_13 (check (created >= TIMESTAMP '2016-01-13 00:00:00-00' and created < TIMESTAMP '2016-01-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_14 (check (created >= TIMESTAMP '2016-01-14 00:00:00-00' and created < TIMESTAMP '2016-01-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_15 (check (created >= TIMESTAMP '2016-01-15 00:00:00-00' and created < TIMESTAMP '2016-01-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_16 (check (created >= TIMESTAMP '2016-01-16 00:00:00-00' and created < TIMESTAMP '2016-01-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_17 (check (created >= TIMESTAMP '2016-01-17 00:00:00-00' and created < TIMESTAMP '2016-01-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_18 (check (created >= TIMESTAMP '2016-01-18 00:00:00-00' and created < TIMESTAMP '2016-01-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_19 (check (created >= TIMESTAMP '2016-01-19 00:00:00-00' and created < TIMESTAMP '2016-01-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_20 (check (created >= TIMESTAMP '2016-01-20 00:00:00-00' and created < TIMESTAMP '2016-01-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_21 (check (created >= TIMESTAMP '2016-01-21 00:00:00-00' and created < TIMESTAMP '2016-01-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_22 (check (created >= TIMESTAMP '2016-01-22 00:00:00-00' and created < TIMESTAMP '2016-01-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_23 (check (created >= TIMESTAMP '2016-01-23 00:00:00-00' and created < TIMESTAMP '2016-01-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_24 (check (created >= TIMESTAMP '2016-01-24 00:00:00-00' and created < TIMESTAMP '2016-01-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_25 (check (created >= TIMESTAMP '2016-01-25 00:00:00-00' and created < TIMESTAMP '2016-01-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_26 (check (created >= TIMESTAMP '2016-01-26 00:00:00-00' and created < TIMESTAMP '2016-01-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_27 (check (created >= TIMESTAMP '2016-01-27 00:00:00-00' and created < TIMESTAMP '2016-01-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_28 (check (created >= TIMESTAMP '2016-01-28 00:00:00-00' and created < TIMESTAMP '2016-01-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_29 (check (created >= TIMESTAMP '2016-01-29 00:00:00-00' and created < TIMESTAMP '2016-01-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_30 (check (created >= TIMESTAMP '2016-01-30 00:00:00-00' and created < TIMESTAMP '2016-01-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_01_31 (check (created >= TIMESTAMP '2016-01-31 00:00:00-00' and created < TIMESTAMP '2016-02-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_01 (check (created >= TIMESTAMP '2016-02-01 00:00:00-00' and created < TIMESTAMP '2016-02-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_02 (check (created >= TIMESTAMP '2016-02-02 00:00:00-00' and created < TIMESTAMP '2016-02-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_03 (check (created >= TIMESTAMP '2016-02-03 00:00:00-00' and created < TIMESTAMP '2016-02-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_04 (check (created >= TIMESTAMP '2016-02-04 00:00:00-00' and created < TIMESTAMP '2016-02-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_05 (check (created >= TIMESTAMP '2016-02-05 00:00:00-00' and created < TIMESTAMP '2016-02-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_06 (check (created >= TIMESTAMP '2016-02-06 00:00:00-00' and created < TIMESTAMP '2016-02-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_07 (check (created >= TIMESTAMP '2016-02-07 00:00:00-00' and created < TIMESTAMP '2016-02-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_08 (check (created >= TIMESTAMP '2016-02-08 00:00:00-00' and created < TIMESTAMP '2016-02-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_09 (check (created >= TIMESTAMP '2016-02-09 00:00:00-00' and created < TIMESTAMP '2016-02-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_10 (check (created >= TIMESTAMP '2016-02-10 00:00:00-00' and created < TIMESTAMP '2016-02-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_11 (check (created >= TIMESTAMP '2016-02-11 00:00:00-00' and created < TIMESTAMP '2016-02-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_12 (check (created >= TIMESTAMP '2016-02-12 00:00:00-00' and created < TIMESTAMP '2016-02-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_13 (check (created >= TIMESTAMP '2016-02-13 00:00:00-00' and created < TIMESTAMP '2016-02-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_14 (check (created >= TIMESTAMP '2016-02-14 00:00:00-00' and created < TIMESTAMP '2016-02-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_15 (check (created >= TIMESTAMP '2016-02-15 00:00:00-00' and created < TIMESTAMP '2016-02-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_16 (check (created >= TIMESTAMP '2016-02-16 00:00:00-00' and created < TIMESTAMP '2016-02-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_17 (check (created >= TIMESTAMP '2016-02-17 00:00:00-00' and created < TIMESTAMP '2016-02-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_18 (check (created >= TIMESTAMP '2016-02-18 00:00:00-00' and created < TIMESTAMP '2016-02-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_19 (check (created >= TIMESTAMP '2016-02-19 00:00:00-00' and created < TIMESTAMP '2016-02-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_20 (check (created >= TIMESTAMP '2016-02-20 00:00:00-00' and created < TIMESTAMP '2016-02-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_21 (check (created >= TIMESTAMP '2016-02-21 00:00:00-00' and created < TIMESTAMP '2016-02-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_22 (check (created >= TIMESTAMP '2016-02-22 00:00:00-00' and created < TIMESTAMP '2016-02-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_23 (check (created >= TIMESTAMP '2016-02-23 00:00:00-00' and created < TIMESTAMP '2016-02-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_24 (check (created >= TIMESTAMP '2016-02-24 00:00:00-00' and created < TIMESTAMP '2016-02-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_25 (check (created >= TIMESTAMP '2016-02-25 00:00:00-00' and created < TIMESTAMP '2016-02-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_26 (check (created >= TIMESTAMP '2016-02-26 00:00:00-00' and created < TIMESTAMP '2016-02-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_27 (check (created >= TIMESTAMP '2016-02-27 00:00:00-00' and created < TIMESTAMP '2016-02-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_28 (check (created >= TIMESTAMP '2016-02-28 00:00:00-00' and created < TIMESTAMP '2016-02-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_02_29 (check (created >= TIMESTAMP '2016-02-29 00:00:00-00' and created < TIMESTAMP '2016-03-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_01 (check (created >= TIMESTAMP '2016-03-01 00:00:00-00' and created < TIMESTAMP '2016-03-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_02 (check (created >= TIMESTAMP '2016-03-02 00:00:00-00' and created < TIMESTAMP '2016-03-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_03 (check (created >= TIMESTAMP '2016-03-03 00:00:00-00' and created < TIMESTAMP '2016-03-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_04 (check (created >= TIMESTAMP '2016-03-04 00:00:00-00' and created < TIMESTAMP '2016-03-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_05 (check (created >= TIMESTAMP '2016-03-05 00:00:00-00' and created < TIMESTAMP '2016-03-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_06 (check (created >= TIMESTAMP '2016-03-06 00:00:00-00' and created < TIMESTAMP '2016-03-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_07 (check (created >= TIMESTAMP '2016-03-07 00:00:00-00' and created < TIMESTAMP '2016-03-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_08 (check (created >= TIMESTAMP '2016-03-08 00:00:00-00' and created < TIMESTAMP '2016-03-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_09 (check (created >= TIMESTAMP '2016-03-09 00:00:00-00' and created < TIMESTAMP '2016-03-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_10 (check (created >= TIMESTAMP '2016-03-10 00:00:00-00' and created < TIMESTAMP '2016-03-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_11 (check (created >= TIMESTAMP '2016-03-11 00:00:00-00' and created < TIMESTAMP '2016-03-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_12 (check (created >= TIMESTAMP '2016-03-12 00:00:00-00' and created < TIMESTAMP '2016-03-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_13 (check (created >= TIMESTAMP '2016-03-13 00:00:00-00' and created < TIMESTAMP '2016-03-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_14 (check (created >= TIMESTAMP '2016-03-14 00:00:00-00' and created < TIMESTAMP '2016-03-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_15 (check (created >= TIMESTAMP '2016-03-15 00:00:00-00' and created < TIMESTAMP '2016-03-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_16 (check (created >= TIMESTAMP '2016-03-16 00:00:00-00' and created < TIMESTAMP '2016-03-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_17 (check (created >= TIMESTAMP '2016-03-17 00:00:00-00' and created < TIMESTAMP '2016-03-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_18 (check (created >= TIMESTAMP '2016-03-18 00:00:00-00' and created < TIMESTAMP '2016-03-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_19 (check (created >= TIMESTAMP '2016-03-19 00:00:00-00' and created < TIMESTAMP '2016-03-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_20 (check (created >= TIMESTAMP '2016-03-20 00:00:00-00' and created < TIMESTAMP '2016-03-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_21 (check (created >= TIMESTAMP '2016-03-21 00:00:00-00' and created < TIMESTAMP '2016-03-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_22 (check (created >= TIMESTAMP '2016-03-22 00:00:00-00' and created < TIMESTAMP '2016-03-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_23 (check (created >= TIMESTAMP '2016-03-23 00:00:00-00' and created < TIMESTAMP '2016-03-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_24 (check (created >= TIMESTAMP '2016-03-24 00:00:00-00' and created < TIMESTAMP '2016-03-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_25 (check (created >= TIMESTAMP '2016-03-25 00:00:00-00' and created < TIMESTAMP '2016-03-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_26 (check (created >= TIMESTAMP '2016-03-26 00:00:00-00' and created < TIMESTAMP '2016-03-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_27 (check (created >= TIMESTAMP '2016-03-27 00:00:00-00' and created < TIMESTAMP '2016-03-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_28 (check (created >= TIMESTAMP '2016-03-28 00:00:00-00' and created < TIMESTAMP '2016-03-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_29 (check (created >= TIMESTAMP '2016-03-29 00:00:00-00' and created < TIMESTAMP '2016-03-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_30 (check (created >= TIMESTAMP '2016-03-30 00:00:00-00' and created < TIMESTAMP '2016-03-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_03_31 (check (created >= TIMESTAMP '2016-03-31 00:00:00-00' and created < TIMESTAMP '2016-04-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_01 (check (created >= TIMESTAMP '2016-04-01 00:00:00-00' and created < TIMESTAMP '2016-04-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_02 (check (created >= TIMESTAMP '2016-04-02 00:00:00-00' and created < TIMESTAMP '2016-04-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_03 (check (created >= TIMESTAMP '2016-04-03 00:00:00-00' and created < TIMESTAMP '2016-04-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_04 (check (created >= TIMESTAMP '2016-04-04 00:00:00-00' and created < TIMESTAMP '2016-04-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_05 (check (created >= TIMESTAMP '2016-04-05 00:00:00-00' and created < TIMESTAMP '2016-04-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_06 (check (created >= TIMESTAMP '2016-04-06 00:00:00-00' and created < TIMESTAMP '2016-04-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_07 (check (created >= TIMESTAMP '2016-04-07 00:00:00-00' and created < TIMESTAMP '2016-04-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_08 (check (created >= TIMESTAMP '2016-04-08 00:00:00-00' and created < TIMESTAMP '2016-04-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_09 (check (created >= TIMESTAMP '2016-04-09 00:00:00-00' and created < TIMESTAMP '2016-04-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_10 (check (created >= TIMESTAMP '2016-04-10 00:00:00-00' and created < TIMESTAMP '2016-04-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_11 (check (created >= TIMESTAMP '2016-04-11 00:00:00-00' and created < TIMESTAMP '2016-04-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_12 (check (created >= TIMESTAMP '2016-04-12 00:00:00-00' and created < TIMESTAMP '2016-04-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_13 (check (created >= TIMESTAMP '2016-04-13 00:00:00-00' and created < TIMESTAMP '2016-04-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_14 (check (created >= TIMESTAMP '2016-04-14 00:00:00-00' and created < TIMESTAMP '2016-04-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_15 (check (created >= TIMESTAMP '2016-04-15 00:00:00-00' and created < TIMESTAMP '2016-04-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_16 (check (created >= TIMESTAMP '2016-04-16 00:00:00-00' and created < TIMESTAMP '2016-04-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_17 (check (created >= TIMESTAMP '2016-04-17 00:00:00-00' and created < TIMESTAMP '2016-04-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_18 (check (created >= TIMESTAMP '2016-04-18 00:00:00-00' and created < TIMESTAMP '2016-04-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_19 (check (created >= TIMESTAMP '2016-04-19 00:00:00-00' and created < TIMESTAMP '2016-04-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_20 (check (created >= TIMESTAMP '2016-04-20 00:00:00-00' and created < TIMESTAMP '2016-04-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_21 (check (created >= TIMESTAMP '2016-04-21 00:00:00-00' and created < TIMESTAMP '2016-04-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_22 (check (created >= TIMESTAMP '2016-04-22 00:00:00-00' and created < TIMESTAMP '2016-04-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_23 (check (created >= TIMESTAMP '2016-04-23 00:00:00-00' and created < TIMESTAMP '2016-04-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_24 (check (created >= TIMESTAMP '2016-04-24 00:00:00-00' and created < TIMESTAMP '2016-04-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_25 (check (created >= TIMESTAMP '2016-04-25 00:00:00-00' and created < TIMESTAMP '2016-04-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_26 (check (created >= TIMESTAMP '2016-04-26 00:00:00-00' and created < TIMESTAMP '2016-04-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_27 (check (created >= TIMESTAMP '2016-04-27 00:00:00-00' and created < TIMESTAMP '2016-04-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_28 (check (created >= TIMESTAMP '2016-04-28 00:00:00-00' and created < TIMESTAMP '2016-04-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_29 (check (created >= TIMESTAMP '2016-04-29 00:00:00-00' and created < TIMESTAMP '2016-04-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_04_30 (check (created >= TIMESTAMP '2016-04-30 00:00:00-00' and created < TIMESTAMP '2016-05-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_01 (check (created >= TIMESTAMP '2016-05-01 00:00:00-00' and created < TIMESTAMP '2016-05-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_02 (check (created >= TIMESTAMP '2016-05-02 00:00:00-00' and created < TIMESTAMP '2016-05-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_03 (check (created >= TIMESTAMP '2016-05-03 00:00:00-00' and created < TIMESTAMP '2016-05-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_04 (check (created >= TIMESTAMP '2016-05-04 00:00:00-00' and created < TIMESTAMP '2016-05-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_05 (check (created >= TIMESTAMP '2016-05-05 00:00:00-00' and created < TIMESTAMP '2016-05-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_06 (check (created >= TIMESTAMP '2016-05-06 00:00:00-00' and created < TIMESTAMP '2016-05-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_07 (check (created >= TIMESTAMP '2016-05-07 00:00:00-00' and created < TIMESTAMP '2016-05-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_08 (check (created >= TIMESTAMP '2016-05-08 00:00:00-00' and created < TIMESTAMP '2016-05-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_09 (check (created >= TIMESTAMP '2016-05-09 00:00:00-00' and created < TIMESTAMP '2016-05-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_10 (check (created >= TIMESTAMP '2016-05-10 00:00:00-00' and created < TIMESTAMP '2016-05-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_11 (check (created >= TIMESTAMP '2016-05-11 00:00:00-00' and created < TIMESTAMP '2016-05-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_12 (check (created >= TIMESTAMP '2016-05-12 00:00:00-00' and created < TIMESTAMP '2016-05-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_13 (check (created >= TIMESTAMP '2016-05-13 00:00:00-00' and created < TIMESTAMP '2016-05-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_14 (check (created >= TIMESTAMP '2016-05-14 00:00:00-00' and created < TIMESTAMP '2016-05-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_15 (check (created >= TIMESTAMP '2016-05-15 00:00:00-00' and created < TIMESTAMP '2016-05-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_16 (check (created >= TIMESTAMP '2016-05-16 00:00:00-00' and created < TIMESTAMP '2016-05-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_17 (check (created >= TIMESTAMP '2016-05-17 00:00:00-00' and created < TIMESTAMP '2016-05-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_18 (check (created >= TIMESTAMP '2016-05-18 00:00:00-00' and created < TIMESTAMP '2016-05-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_19 (check (created >= TIMESTAMP '2016-05-19 00:00:00-00' and created < TIMESTAMP '2016-05-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_20 (check (created >= TIMESTAMP '2016-05-20 00:00:00-00' and created < TIMESTAMP '2016-05-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_21 (check (created >= TIMESTAMP '2016-05-21 00:00:00-00' and created < TIMESTAMP '2016-05-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_22 (check (created >= TIMESTAMP '2016-05-22 00:00:00-00' and created < TIMESTAMP '2016-05-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_23 (check (created >= TIMESTAMP '2016-05-23 00:00:00-00' and created < TIMESTAMP '2016-05-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_24 (check (created >= TIMESTAMP '2016-05-24 00:00:00-00' and created < TIMESTAMP '2016-05-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_25 (check (created >= TIMESTAMP '2016-05-25 00:00:00-00' and created < TIMESTAMP '2016-05-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_26 (check (created >= TIMESTAMP '2016-05-26 00:00:00-00' and created < TIMESTAMP '2016-05-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_27 (check (created >= TIMESTAMP '2016-05-27 00:00:00-00' and created < TIMESTAMP '2016-05-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_28 (check (created >= TIMESTAMP '2016-05-28 00:00:00-00' and created < TIMESTAMP '2016-05-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_29 (check (created >= TIMESTAMP '2016-05-29 00:00:00-00' and created < TIMESTAMP '2016-05-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_30 (check (created >= TIMESTAMP '2016-05-30 00:00:00-00' and created < TIMESTAMP '2016-05-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_05_31 (check (created >= TIMESTAMP '2016-05-31 00:00:00-00' and created < TIMESTAMP '2016-06-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_01 (check (created >= TIMESTAMP '2016-06-01 00:00:00-00' and created < TIMESTAMP '2016-06-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_02 (check (created >= TIMESTAMP '2016-06-02 00:00:00-00' and created < TIMESTAMP '2016-06-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_03 (check (created >= TIMESTAMP '2016-06-03 00:00:00-00' and created < TIMESTAMP '2016-06-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_04 (check (created >= TIMESTAMP '2016-06-04 00:00:00-00' and created < TIMESTAMP '2016-06-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_05 (check (created >= TIMESTAMP '2016-06-05 00:00:00-00' and created < TIMESTAMP '2016-06-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_06 (check (created >= TIMESTAMP '2016-06-06 00:00:00-00' and created < TIMESTAMP '2016-06-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_07 (check (created >= TIMESTAMP '2016-06-07 00:00:00-00' and created < TIMESTAMP '2016-06-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_08 (check (created >= TIMESTAMP '2016-06-08 00:00:00-00' and created < TIMESTAMP '2016-06-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_09 (check (created >= TIMESTAMP '2016-06-09 00:00:00-00' and created < TIMESTAMP '2016-06-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_10 (check (created >= TIMESTAMP '2016-06-10 00:00:00-00' and created < TIMESTAMP '2016-06-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_11 (check (created >= TIMESTAMP '2016-06-11 00:00:00-00' and created < TIMESTAMP '2016-06-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_12 (check (created >= TIMESTAMP '2016-06-12 00:00:00-00' and created < TIMESTAMP '2016-06-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_13 (check (created >= TIMESTAMP '2016-06-13 00:00:00-00' and created < TIMESTAMP '2016-06-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_14 (check (created >= TIMESTAMP '2016-06-14 00:00:00-00' and created < TIMESTAMP '2016-06-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_15 (check (created >= TIMESTAMP '2016-06-15 00:00:00-00' and created < TIMESTAMP '2016-06-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_16 (check (created >= TIMESTAMP '2016-06-16 00:00:00-00' and created < TIMESTAMP '2016-06-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_17 (check (created >= TIMESTAMP '2016-06-17 00:00:00-00' and created < TIMESTAMP '2016-06-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_18 (check (created >= TIMESTAMP '2016-06-18 00:00:00-00' and created < TIMESTAMP '2016-06-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_19 (check (created >= TIMESTAMP '2016-06-19 00:00:00-00' and created < TIMESTAMP '2016-06-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_20 (check (created >= TIMESTAMP '2016-06-20 00:00:00-00' and created < TIMESTAMP '2016-06-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_21 (check (created >= TIMESTAMP '2016-06-21 00:00:00-00' and created < TIMESTAMP '2016-06-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_22 (check (created >= TIMESTAMP '2016-06-22 00:00:00-00' and created < TIMESTAMP '2016-06-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_23 (check (created >= TIMESTAMP '2016-06-23 00:00:00-00' and created < TIMESTAMP '2016-06-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_24 (check (created >= TIMESTAMP '2016-06-24 00:00:00-00' and created < TIMESTAMP '2016-06-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_25 (check (created >= TIMESTAMP '2016-06-25 00:00:00-00' and created < TIMESTAMP '2016-06-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_26 (check (created >= TIMESTAMP '2016-06-26 00:00:00-00' and created < TIMESTAMP '2016-06-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_27 (check (created >= TIMESTAMP '2016-06-27 00:00:00-00' and created < TIMESTAMP '2016-06-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_28 (check (created >= TIMESTAMP '2016-06-28 00:00:00-00' and created < TIMESTAMP '2016-06-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_29 (check (created >= TIMESTAMP '2016-06-29 00:00:00-00' and created < TIMESTAMP '2016-06-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_06_30 (check (created >= TIMESTAMP '2016-06-30 00:00:00-00' and created < TIMESTAMP '2016-07-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_01 (check (created >= TIMESTAMP '2016-07-01 00:00:00-00' and created < TIMESTAMP '2016-07-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_02 (check (created >= TIMESTAMP '2016-07-02 00:00:00-00' and created < TIMESTAMP '2016-07-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_03 (check (created >= TIMESTAMP '2016-07-03 00:00:00-00' and created < TIMESTAMP '2016-07-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_04 (check (created >= TIMESTAMP '2016-07-04 00:00:00-00' and created < TIMESTAMP '2016-07-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_05 (check (created >= TIMESTAMP '2016-07-05 00:00:00-00' and created < TIMESTAMP '2016-07-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_06 (check (created >= TIMESTAMP '2016-07-06 00:00:00-00' and created < TIMESTAMP '2016-07-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_07 (check (created >= TIMESTAMP '2016-07-07 00:00:00-00' and created < TIMESTAMP '2016-07-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_08 (check (created >= TIMESTAMP '2016-07-08 00:00:00-00' and created < TIMESTAMP '2016-07-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_09 (check (created >= TIMESTAMP '2016-07-09 00:00:00-00' and created < TIMESTAMP '2016-07-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_10 (check (created >= TIMESTAMP '2016-07-10 00:00:00-00' and created < TIMESTAMP '2016-07-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_11 (check (created >= TIMESTAMP '2016-07-11 00:00:00-00' and created < TIMESTAMP '2016-07-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_12 (check (created >= TIMESTAMP '2016-07-12 00:00:00-00' and created < TIMESTAMP '2016-07-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_13 (check (created >= TIMESTAMP '2016-07-13 00:00:00-00' and created < TIMESTAMP '2016-07-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_14 (check (created >= TIMESTAMP '2016-07-14 00:00:00-00' and created < TIMESTAMP '2016-07-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_15 (check (created >= TIMESTAMP '2016-07-15 00:00:00-00' and created < TIMESTAMP '2016-07-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_16 (check (created >= TIMESTAMP '2016-07-16 00:00:00-00' and created < TIMESTAMP '2016-07-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_17 (check (created >= TIMESTAMP '2016-07-17 00:00:00-00' and created < TIMESTAMP '2016-07-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_18 (check (created >= TIMESTAMP '2016-07-18 00:00:00-00' and created < TIMESTAMP '2016-07-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_19 (check (created >= TIMESTAMP '2016-07-19 00:00:00-00' and created < TIMESTAMP '2016-07-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_20 (check (created >= TIMESTAMP '2016-07-20 00:00:00-00' and created < TIMESTAMP '2016-07-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_21 (check (created >= TIMESTAMP '2016-07-21 00:00:00-00' and created < TIMESTAMP '2016-07-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_22 (check (created >= TIMESTAMP '2016-07-22 00:00:00-00' and created < TIMESTAMP '2016-07-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_23 (check (created >= TIMESTAMP '2016-07-23 00:00:00-00' and created < TIMESTAMP '2016-07-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_24 (check (created >= TIMESTAMP '2016-07-24 00:00:00-00' and created < TIMESTAMP '2016-07-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_25 (check (created >= TIMESTAMP '2016-07-25 00:00:00-00' and created < TIMESTAMP '2016-07-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_26 (check (created >= TIMESTAMP '2016-07-26 00:00:00-00' and created < TIMESTAMP '2016-07-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_27 (check (created >= TIMESTAMP '2016-07-27 00:00:00-00' and created < TIMESTAMP '2016-07-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_28 (check (created >= TIMESTAMP '2016-07-28 00:00:00-00' and created < TIMESTAMP '2016-07-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_29 (check (created >= TIMESTAMP '2016-07-29 00:00:00-00' and created < TIMESTAMP '2016-07-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_30 (check (created >= TIMESTAMP '2016-07-30 00:00:00-00' and created < TIMESTAMP '2016-07-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_07_31 (check (created >= TIMESTAMP '2016-07-31 00:00:00-00' and created < TIMESTAMP '2016-08-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_01 (check (created >= TIMESTAMP '2016-08-01 00:00:00-00' and created < TIMESTAMP '2016-08-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_02 (check (created >= TIMESTAMP '2016-08-02 00:00:00-00' and created < TIMESTAMP '2016-08-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_03 (check (created >= TIMESTAMP '2016-08-03 00:00:00-00' and created < TIMESTAMP '2016-08-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_04 (check (created >= TIMESTAMP '2016-08-04 00:00:00-00' and created < TIMESTAMP '2016-08-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_05 (check (created >= TIMESTAMP '2016-08-05 00:00:00-00' and created < TIMESTAMP '2016-08-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_06 (check (created >= TIMESTAMP '2016-08-06 00:00:00-00' and created < TIMESTAMP '2016-08-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_07 (check (created >= TIMESTAMP '2016-08-07 00:00:00-00' and created < TIMESTAMP '2016-08-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_08 (check (created >= TIMESTAMP '2016-08-08 00:00:00-00' and created < TIMESTAMP '2016-08-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_09 (check (created >= TIMESTAMP '2016-08-09 00:00:00-00' and created < TIMESTAMP '2016-08-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_10 (check (created >= TIMESTAMP '2016-08-10 00:00:00-00' and created < TIMESTAMP '2016-08-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_11 (check (created >= TIMESTAMP '2016-08-11 00:00:00-00' and created < TIMESTAMP '2016-08-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_12 (check (created >= TIMESTAMP '2016-08-12 00:00:00-00' and created < TIMESTAMP '2016-08-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_13 (check (created >= TIMESTAMP '2016-08-13 00:00:00-00' and created < TIMESTAMP '2016-08-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_14 (check (created >= TIMESTAMP '2016-08-14 00:00:00-00' and created < TIMESTAMP '2016-08-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_15 (check (created >= TIMESTAMP '2016-08-15 00:00:00-00' and created < TIMESTAMP '2016-08-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_16 (check (created >= TIMESTAMP '2016-08-16 00:00:00-00' and created < TIMESTAMP '2016-08-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_17 (check (created >= TIMESTAMP '2016-08-17 00:00:00-00' and created < TIMESTAMP '2016-08-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_18 (check (created >= TIMESTAMP '2016-08-18 00:00:00-00' and created < TIMESTAMP '2016-08-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_19 (check (created >= TIMESTAMP '2016-08-19 00:00:00-00' and created < TIMESTAMP '2016-08-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_20 (check (created >= TIMESTAMP '2016-08-20 00:00:00-00' and created < TIMESTAMP '2016-08-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_21 (check (created >= TIMESTAMP '2016-08-21 00:00:00-00' and created < TIMESTAMP '2016-08-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_22 (check (created >= TIMESTAMP '2016-08-22 00:00:00-00' and created < TIMESTAMP '2016-08-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_23 (check (created >= TIMESTAMP '2016-08-23 00:00:00-00' and created < TIMESTAMP '2016-08-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_24 (check (created >= TIMESTAMP '2016-08-24 00:00:00-00' and created < TIMESTAMP '2016-08-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_25 (check (created >= TIMESTAMP '2016-08-25 00:00:00-00' and created < TIMESTAMP '2016-08-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_26 (check (created >= TIMESTAMP '2016-08-26 00:00:00-00' and created < TIMESTAMP '2016-08-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_27 (check (created >= TIMESTAMP '2016-08-27 00:00:00-00' and created < TIMESTAMP '2016-08-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_28 (check (created >= TIMESTAMP '2016-08-28 00:00:00-00' and created < TIMESTAMP '2016-08-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_29 (check (created >= TIMESTAMP '2016-08-29 00:00:00-00' and created < TIMESTAMP '2016-08-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_30 (check (created >= TIMESTAMP '2016-08-30 00:00:00-00' and created < TIMESTAMP '2016-08-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_08_31 (check (created >= TIMESTAMP '2016-08-31 00:00:00-00' and created < TIMESTAMP '2016-09-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_01 (check (created >= TIMESTAMP '2016-09-01 00:00:00-00' and created < TIMESTAMP '2016-09-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_02 (check (created >= TIMESTAMP '2016-09-02 00:00:00-00' and created < TIMESTAMP '2016-09-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_03 (check (created >= TIMESTAMP '2016-09-03 00:00:00-00' and created < TIMESTAMP '2016-09-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_04 (check (created >= TIMESTAMP '2016-09-04 00:00:00-00' and created < TIMESTAMP '2016-09-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_05 (check (created >= TIMESTAMP '2016-09-05 00:00:00-00' and created < TIMESTAMP '2016-09-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_06 (check (created >= TIMESTAMP '2016-09-06 00:00:00-00' and created < TIMESTAMP '2016-09-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_07 (check (created >= TIMESTAMP '2016-09-07 00:00:00-00' and created < TIMESTAMP '2016-09-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_08 (check (created >= TIMESTAMP '2016-09-08 00:00:00-00' and created < TIMESTAMP '2016-09-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_09 (check (created >= TIMESTAMP '2016-09-09 00:00:00-00' and created < TIMESTAMP '2016-09-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_10 (check (created >= TIMESTAMP '2016-09-10 00:00:00-00' and created < TIMESTAMP '2016-09-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_11 (check (created >= TIMESTAMP '2016-09-11 00:00:00-00' and created < TIMESTAMP '2016-09-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_12 (check (created >= TIMESTAMP '2016-09-12 00:00:00-00' and created < TIMESTAMP '2016-09-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_13 (check (created >= TIMESTAMP '2016-09-13 00:00:00-00' and created < TIMESTAMP '2016-09-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_14 (check (created >= TIMESTAMP '2016-09-14 00:00:00-00' and created < TIMESTAMP '2016-09-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_15 (check (created >= TIMESTAMP '2016-09-15 00:00:00-00' and created < TIMESTAMP '2016-09-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_16 (check (created >= TIMESTAMP '2016-09-16 00:00:00-00' and created < TIMESTAMP '2016-09-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_17 (check (created >= TIMESTAMP '2016-09-17 00:00:00-00' and created < TIMESTAMP '2016-09-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_18 (check (created >= TIMESTAMP '2016-09-18 00:00:00-00' and created < TIMESTAMP '2016-09-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_19 (check (created >= TIMESTAMP '2016-09-19 00:00:00-00' and created < TIMESTAMP '2016-09-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_20 (check (created >= TIMESTAMP '2016-09-20 00:00:00-00' and created < TIMESTAMP '2016-09-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_21 (check (created >= TIMESTAMP '2016-09-21 00:00:00-00' and created < TIMESTAMP '2016-09-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_22 (check (created >= TIMESTAMP '2016-09-22 00:00:00-00' and created < TIMESTAMP '2016-09-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_23 (check (created >= TIMESTAMP '2016-09-23 00:00:00-00' and created < TIMESTAMP '2016-09-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_24 (check (created >= TIMESTAMP '2016-09-24 00:00:00-00' and created < TIMESTAMP '2016-09-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_25 (check (created >= TIMESTAMP '2016-09-25 00:00:00-00' and created < TIMESTAMP '2016-09-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_26 (check (created >= TIMESTAMP '2016-09-26 00:00:00-00' and created < TIMESTAMP '2016-09-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_27 (check (created >= TIMESTAMP '2016-09-27 00:00:00-00' and created < TIMESTAMP '2016-09-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_28 (check (created >= TIMESTAMP '2016-09-28 00:00:00-00' and created < TIMESTAMP '2016-09-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_29 (check (created >= TIMESTAMP '2016-09-29 00:00:00-00' and created < TIMESTAMP '2016-09-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_09_30 (check (created >= TIMESTAMP '2016-09-30 00:00:00-00' and created < TIMESTAMP '2016-10-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_01 (check (created >= TIMESTAMP '2016-10-01 00:00:00-00' and created < TIMESTAMP '2016-10-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_02 (check (created >= TIMESTAMP '2016-10-02 00:00:00-00' and created < TIMESTAMP '2016-10-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_03 (check (created >= TIMESTAMP '2016-10-03 00:00:00-00' and created < TIMESTAMP '2016-10-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_04 (check (created >= TIMESTAMP '2016-10-04 00:00:00-00' and created < TIMESTAMP '2016-10-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_05 (check (created >= TIMESTAMP '2016-10-05 00:00:00-00' and created < TIMESTAMP '2016-10-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_06 (check (created >= TIMESTAMP '2016-10-06 00:00:00-00' and created < TIMESTAMP '2016-10-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_07 (check (created >= TIMESTAMP '2016-10-07 00:00:00-00' and created < TIMESTAMP '2016-10-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_08 (check (created >= TIMESTAMP '2016-10-08 00:00:00-00' and created < TIMESTAMP '2016-10-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_09 (check (created >= TIMESTAMP '2016-10-09 00:00:00-00' and created < TIMESTAMP '2016-10-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_10 (check (created >= TIMESTAMP '2016-10-10 00:00:00-00' and created < TIMESTAMP '2016-10-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_11 (check (created >= TIMESTAMP '2016-10-11 00:00:00-00' and created < TIMESTAMP '2016-10-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_12 (check (created >= TIMESTAMP '2016-10-12 00:00:00-00' and created < TIMESTAMP '2016-10-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_13 (check (created >= TIMESTAMP '2016-10-13 00:00:00-00' and created < TIMESTAMP '2016-10-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_14 (check (created >= TIMESTAMP '2016-10-14 00:00:00-00' and created < TIMESTAMP '2016-10-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_15 (check (created >= TIMESTAMP '2016-10-15 00:00:00-00' and created < TIMESTAMP '2016-10-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_16 (check (created >= TIMESTAMP '2016-10-16 00:00:00-00' and created < TIMESTAMP '2016-10-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_17 (check (created >= TIMESTAMP '2016-10-17 00:00:00-00' and created < TIMESTAMP '2016-10-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_18 (check (created >= TIMESTAMP '2016-10-18 00:00:00-00' and created < TIMESTAMP '2016-10-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_19 (check (created >= TIMESTAMP '2016-10-19 00:00:00-00' and created < TIMESTAMP '2016-10-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_20 (check (created >= TIMESTAMP '2016-10-20 00:00:00-00' and created < TIMESTAMP '2016-10-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_21 (check (created >= TIMESTAMP '2016-10-21 00:00:00-00' and created < TIMESTAMP '2016-10-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_22 (check (created >= TIMESTAMP '2016-10-22 00:00:00-00' and created < TIMESTAMP '2016-10-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_23 (check (created >= TIMESTAMP '2016-10-23 00:00:00-00' and created < TIMESTAMP '2016-10-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_24 (check (created >= TIMESTAMP '2016-10-24 00:00:00-00' and created < TIMESTAMP '2016-10-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_25 (check (created >= TIMESTAMP '2016-10-25 00:00:00-00' and created < TIMESTAMP '2016-10-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_26 (check (created >= TIMESTAMP '2016-10-26 00:00:00-00' and created < TIMESTAMP '2016-10-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_27 (check (created >= TIMESTAMP '2016-10-27 00:00:00-00' and created < TIMESTAMP '2016-10-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_28 (check (created >= TIMESTAMP '2016-10-28 00:00:00-00' and created < TIMESTAMP '2016-10-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_29 (check (created >= TIMESTAMP '2016-10-29 00:00:00-00' and created < TIMESTAMP '2016-10-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_30 (check (created >= TIMESTAMP '2016-10-30 00:00:00-00' and created < TIMESTAMP '2016-10-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_10_31 (check (created >= TIMESTAMP '2016-10-31 00:00:00-00' and created < TIMESTAMP '2016-11-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_01 (check (created >= TIMESTAMP '2016-11-01 00:00:00-00' and created < TIMESTAMP '2016-11-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_02 (check (created >= TIMESTAMP '2016-11-02 00:00:00-00' and created < TIMESTAMP '2016-11-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_03 (check (created >= TIMESTAMP '2016-11-03 00:00:00-00' and created < TIMESTAMP '2016-11-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_04 (check (created >= TIMESTAMP '2016-11-04 00:00:00-00' and created < TIMESTAMP '2016-11-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_05 (check (created >= TIMESTAMP '2016-11-05 00:00:00-00' and created < TIMESTAMP '2016-11-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_06 (check (created >= TIMESTAMP '2016-11-06 00:00:00-00' and created < TIMESTAMP '2016-11-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_07 (check (created >= TIMESTAMP '2016-11-07 00:00:00-00' and created < TIMESTAMP '2016-11-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_08 (check (created >= TIMESTAMP '2016-11-08 00:00:00-00' and created < TIMESTAMP '2016-11-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_09 (check (created >= TIMESTAMP '2016-11-09 00:00:00-00' and created < TIMESTAMP '2016-11-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_10 (check (created >= TIMESTAMP '2016-11-10 00:00:00-00' and created < TIMESTAMP '2016-11-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_11 (check (created >= TIMESTAMP '2016-11-11 00:00:00-00' and created < TIMESTAMP '2016-11-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_12 (check (created >= TIMESTAMP '2016-11-12 00:00:00-00' and created < TIMESTAMP '2016-11-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_13 (check (created >= TIMESTAMP '2016-11-13 00:00:00-00' and created < TIMESTAMP '2016-11-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_14 (check (created >= TIMESTAMP '2016-11-14 00:00:00-00' and created < TIMESTAMP '2016-11-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_15 (check (created >= TIMESTAMP '2016-11-15 00:00:00-00' and created < TIMESTAMP '2016-11-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_16 (check (created >= TIMESTAMP '2016-11-16 00:00:00-00' and created < TIMESTAMP '2016-11-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_17 (check (created >= TIMESTAMP '2016-11-17 00:00:00-00' and created < TIMESTAMP '2016-11-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_18 (check (created >= TIMESTAMP '2016-11-18 00:00:00-00' and created < TIMESTAMP '2016-11-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_19 (check (created >= TIMESTAMP '2016-11-19 00:00:00-00' and created < TIMESTAMP '2016-11-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_20 (check (created >= TIMESTAMP '2016-11-20 00:00:00-00' and created < TIMESTAMP '2016-11-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_21 (check (created >= TIMESTAMP '2016-11-21 00:00:00-00' and created < TIMESTAMP '2016-11-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_22 (check (created >= TIMESTAMP '2016-11-22 00:00:00-00' and created < TIMESTAMP '2016-11-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_23 (check (created >= TIMESTAMP '2016-11-23 00:00:00-00' and created < TIMESTAMP '2016-11-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_24 (check (created >= TIMESTAMP '2016-11-24 00:00:00-00' and created < TIMESTAMP '2016-11-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_25 (check (created >= TIMESTAMP '2016-11-25 00:00:00-00' and created < TIMESTAMP '2016-11-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_26 (check (created >= TIMESTAMP '2016-11-26 00:00:00-00' and created < TIMESTAMP '2016-11-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_27 (check (created >= TIMESTAMP '2016-11-27 00:00:00-00' and created < TIMESTAMP '2016-11-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_28 (check (created >= TIMESTAMP '2016-11-28 00:00:00-00' and created < TIMESTAMP '2016-11-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_29 (check (created >= TIMESTAMP '2016-11-29 00:00:00-00' and created < TIMESTAMP '2016-11-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_11_30 (check (created >= TIMESTAMP '2016-11-30 00:00:00-00' and created < TIMESTAMP '2016-12-01 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_01 (check (created >= TIMESTAMP '2016-12-01 00:00:00-00' and created < TIMESTAMP '2016-12-02 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_02 (check (created >= TIMESTAMP '2016-12-02 00:00:00-00' and created < TIMESTAMP '2016-12-03 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_03 (check (created >= TIMESTAMP '2016-12-03 00:00:00-00' and created < TIMESTAMP '2016-12-04 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_04 (check (created >= TIMESTAMP '2016-12-04 00:00:00-00' and created < TIMESTAMP '2016-12-05 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_05 (check (created >= TIMESTAMP '2016-12-05 00:00:00-00' and created < TIMESTAMP '2016-12-06 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_06 (check (created >= TIMESTAMP '2016-12-06 00:00:00-00' and created < TIMESTAMP '2016-12-07 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_07 (check (created >= TIMESTAMP '2016-12-07 00:00:00-00' and created < TIMESTAMP '2016-12-08 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_08 (check (created >= TIMESTAMP '2016-12-08 00:00:00-00' and created < TIMESTAMP '2016-12-09 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_09 (check (created >= TIMESTAMP '2016-12-09 00:00:00-00' and created < TIMESTAMP '2016-12-10 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_10 (check (created >= TIMESTAMP '2016-12-10 00:00:00-00' and created < TIMESTAMP '2016-12-11 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_11 (check (created >= TIMESTAMP '2016-12-11 00:00:00-00' and created < TIMESTAMP '2016-12-12 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_12 (check (created >= TIMESTAMP '2016-12-12 00:00:00-00' and created < TIMESTAMP '2016-12-13 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_13 (check (created >= TIMESTAMP '2016-12-13 00:00:00-00' and created < TIMESTAMP '2016-12-14 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_14 (check (created >= TIMESTAMP '2016-12-14 00:00:00-00' and created < TIMESTAMP '2016-12-15 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_15 (check (created >= TIMESTAMP '2016-12-15 00:00:00-00' and created < TIMESTAMP '2016-12-16 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_16 (check (created >= TIMESTAMP '2016-12-16 00:00:00-00' and created < TIMESTAMP '2016-12-17 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_17 (check (created >= TIMESTAMP '2016-12-17 00:00:00-00' and created < TIMESTAMP '2016-12-18 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_18 (check (created >= TIMESTAMP '2016-12-18 00:00:00-00' and created < TIMESTAMP '2016-12-19 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_19 (check (created >= TIMESTAMP '2016-12-19 00:00:00-00' and created < TIMESTAMP '2016-12-20 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_20 (check (created >= TIMESTAMP '2016-12-20 00:00:00-00' and created < TIMESTAMP '2016-12-21 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_21 (check (created >= TIMESTAMP '2016-12-21 00:00:00-00' and created < TIMESTAMP '2016-12-22 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_22 (check (created >= TIMESTAMP '2016-12-22 00:00:00-00' and created < TIMESTAMP '2016-12-23 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_23 (check (created >= TIMESTAMP '2016-12-23 00:00:00-00' and created < TIMESTAMP '2016-12-24 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_24 (check (created >= TIMESTAMP '2016-12-24 00:00:00-00' and created < TIMESTAMP '2016-12-25 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_25 (check (created >= TIMESTAMP '2016-12-25 00:00:00-00' and created < TIMESTAMP '2016-12-26 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_26 (check (created >= TIMESTAMP '2016-12-26 00:00:00-00' and created < TIMESTAMP '2016-12-27 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_27 (check (created >= TIMESTAMP '2016-12-27 00:00:00-00' and created < TIMESTAMP '2016-12-28 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_28 (check (created >= TIMESTAMP '2016-12-28 00:00:00-00' and created < TIMESTAMP '2016-12-29 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_29 (check (created >= TIMESTAMP '2016-12-29 00:00:00-00' and created < TIMESTAMP '2016-12-30 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_30 (check (created >= TIMESTAMP '2016-12-30 00:00:00-00' and created < TIMESTAMP '2016-12-31 00:00:00-00')) inherits (ts_metrics);
  create table IF NOT EXISTS ts_metrics_2016_12_31 (check (created >= TIMESTAMP '2016-12-31 00:00:00-00' and created < TIMESTAMP '2017-01-01 00:00:00-00')) inherits (ts_metrics);
  
  create index IF NOT EXISTS idx_ts_metrics_2016_01_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_01_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_01_31 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_02_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_02_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_03_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_03_31 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_04_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_04_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_05_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_05_31 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_06_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_06_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_07_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_07_31 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_08_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_08_31 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_09_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_09_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_10_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_10_31 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_11_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_11_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_01_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_01 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_02_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_02 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_03_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_03 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_04_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_04 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_05_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_05 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_06_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_06 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_07_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_07 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_08_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_08 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_09_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_09 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_10_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_10 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_11_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_11 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_12_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_12 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_13_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_13 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_14_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_14 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_15_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_15 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_16_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_16 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_17_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_17 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_18_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_18 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_19_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_19 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_20_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_20 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_21_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_21 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_22_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_22 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_23_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_23 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_24_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_24 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_25_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_25 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_26_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_26 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_27_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_27 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_28_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_28 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_29_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_29 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_30_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_30 using brin (cluster_id,metric_id,created,deleted);
  create index IF NOT EXISTS idx_ts_metrics_2016_12_31_cluster_id_metric_id_created_deleted on ts_metrics_2016_12_31 using brin (cluster_id,metric_id,created,deleted);
  
  create or replace function on_ts_metrics_insert_2016() returns trigger as $$
  begin
      if ( new.created >= TIMESTAMP '2016-01-01 00:00:00-00' and new.created < TIMESTAMP '2016-01-02 00:00:00-00') then
          insert into ts_metrics_2016_01_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-02 00:00:00-00' and new.created < TIMESTAMP '2016-01-03 00:00:00-00') then
          insert into ts_metrics_2016_01_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-03 00:00:00-00' and new.created < TIMESTAMP '2016-01-04 00:00:00-00') then
          insert into ts_metrics_2016_01_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-04 00:00:00-00' and new.created < TIMESTAMP '2016-01-05 00:00:00-00') then
          insert into ts_metrics_2016_01_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-05 00:00:00-00' and new.created < TIMESTAMP '2016-01-06 00:00:00-00') then
          insert into ts_metrics_2016_01_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-06 00:00:00-00' and new.created < TIMESTAMP '2016-01-07 00:00:00-00') then
          insert into ts_metrics_2016_01_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-07 00:00:00-00' and new.created < TIMESTAMP '2016-01-08 00:00:00-00') then
          insert into ts_metrics_2016_01_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-08 00:00:00-00' and new.created < TIMESTAMP '2016-01-09 00:00:00-00') then
          insert into ts_metrics_2016_01_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-09 00:00:00-00' and new.created < TIMESTAMP '2016-01-10 00:00:00-00') then
          insert into ts_metrics_2016_01_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-10 00:00:00-00' and new.created < TIMESTAMP '2016-01-11 00:00:00-00') then
          insert into ts_metrics_2016_01_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-11 00:00:00-00' and new.created < TIMESTAMP '2016-01-12 00:00:00-00') then
          insert into ts_metrics_2016_01_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-12 00:00:00-00' and new.created < TIMESTAMP '2016-01-13 00:00:00-00') then
          insert into ts_metrics_2016_01_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-13 00:00:00-00' and new.created < TIMESTAMP '2016-01-14 00:00:00-00') then
          insert into ts_metrics_2016_01_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-14 00:00:00-00' and new.created < TIMESTAMP '2016-01-15 00:00:00-00') then
          insert into ts_metrics_2016_01_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-15 00:00:00-00' and new.created < TIMESTAMP '2016-01-16 00:00:00-00') then
          insert into ts_metrics_2016_01_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-16 00:00:00-00' and new.created < TIMESTAMP '2016-01-17 00:00:00-00') then
          insert into ts_metrics_2016_01_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-17 00:00:00-00' and new.created < TIMESTAMP '2016-01-18 00:00:00-00') then
          insert into ts_metrics_2016_01_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-18 00:00:00-00' and new.created < TIMESTAMP '2016-01-19 00:00:00-00') then
          insert into ts_metrics_2016_01_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-19 00:00:00-00' and new.created < TIMESTAMP '2016-01-20 00:00:00-00') then
          insert into ts_metrics_2016_01_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-20 00:00:00-00' and new.created < TIMESTAMP '2016-01-21 00:00:00-00') then
          insert into ts_metrics_2016_01_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-21 00:00:00-00' and new.created < TIMESTAMP '2016-01-22 00:00:00-00') then
          insert into ts_metrics_2016_01_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-22 00:00:00-00' and new.created < TIMESTAMP '2016-01-23 00:00:00-00') then
          insert into ts_metrics_2016_01_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-23 00:00:00-00' and new.created < TIMESTAMP '2016-01-24 00:00:00-00') then
          insert into ts_metrics_2016_01_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-24 00:00:00-00' and new.created < TIMESTAMP '2016-01-25 00:00:00-00') then
          insert into ts_metrics_2016_01_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-25 00:00:00-00' and new.created < TIMESTAMP '2016-01-26 00:00:00-00') then
          insert into ts_metrics_2016_01_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-26 00:00:00-00' and new.created < TIMESTAMP '2016-01-27 00:00:00-00') then
          insert into ts_metrics_2016_01_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-27 00:00:00-00' and new.created < TIMESTAMP '2016-01-28 00:00:00-00') then
          insert into ts_metrics_2016_01_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-28 00:00:00-00' and new.created < TIMESTAMP '2016-01-29 00:00:00-00') then
          insert into ts_metrics_2016_01_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-29 00:00:00-00' and new.created < TIMESTAMP '2016-01-30 00:00:00-00') then
          insert into ts_metrics_2016_01_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-30 00:00:00-00' and new.created < TIMESTAMP '2016-01-31 00:00:00-00') then
          insert into ts_metrics_2016_01_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-01-31 00:00:00-00' and new.created < TIMESTAMP '2016-02-01 00:00:00-00') then
          insert into ts_metrics_2016_01_31 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-01 00:00:00-00' and new.created < TIMESTAMP '2016-02-02 00:00:00-00') then
          insert into ts_metrics_2016_02_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-02 00:00:00-00' and new.created < TIMESTAMP '2016-02-03 00:00:00-00') then
          insert into ts_metrics_2016_02_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-03 00:00:00-00' and new.created < TIMESTAMP '2016-02-04 00:00:00-00') then
          insert into ts_metrics_2016_02_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-04 00:00:00-00' and new.created < TIMESTAMP '2016-02-05 00:00:00-00') then
          insert into ts_metrics_2016_02_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-05 00:00:00-00' and new.created < TIMESTAMP '2016-02-06 00:00:00-00') then
          insert into ts_metrics_2016_02_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-06 00:00:00-00' and new.created < TIMESTAMP '2016-02-07 00:00:00-00') then
          insert into ts_metrics_2016_02_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-07 00:00:00-00' and new.created < TIMESTAMP '2016-02-08 00:00:00-00') then
          insert into ts_metrics_2016_02_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-08 00:00:00-00' and new.created < TIMESTAMP '2016-02-09 00:00:00-00') then
          insert into ts_metrics_2016_02_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-09 00:00:00-00' and new.created < TIMESTAMP '2016-02-10 00:00:00-00') then
          insert into ts_metrics_2016_02_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-10 00:00:00-00' and new.created < TIMESTAMP '2016-02-11 00:00:00-00') then
          insert into ts_metrics_2016_02_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-11 00:00:00-00' and new.created < TIMESTAMP '2016-02-12 00:00:00-00') then
          insert into ts_metrics_2016_02_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-12 00:00:00-00' and new.created < TIMESTAMP '2016-02-13 00:00:00-00') then
          insert into ts_metrics_2016_02_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-13 00:00:00-00' and new.created < TIMESTAMP '2016-02-14 00:00:00-00') then
          insert into ts_metrics_2016_02_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-14 00:00:00-00' and new.created < TIMESTAMP '2016-02-15 00:00:00-00') then
          insert into ts_metrics_2016_02_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-15 00:00:00-00' and new.created < TIMESTAMP '2016-02-16 00:00:00-00') then
          insert into ts_metrics_2016_02_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-16 00:00:00-00' and new.created < TIMESTAMP '2016-02-17 00:00:00-00') then
          insert into ts_metrics_2016_02_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-17 00:00:00-00' and new.created < TIMESTAMP '2016-02-18 00:00:00-00') then
          insert into ts_metrics_2016_02_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-18 00:00:00-00' and new.created < TIMESTAMP '2016-02-19 00:00:00-00') then
          insert into ts_metrics_2016_02_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-19 00:00:00-00' and new.created < TIMESTAMP '2016-02-20 00:00:00-00') then
          insert into ts_metrics_2016_02_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-20 00:00:00-00' and new.created < TIMESTAMP '2016-02-21 00:00:00-00') then
          insert into ts_metrics_2016_02_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-21 00:00:00-00' and new.created < TIMESTAMP '2016-02-22 00:00:00-00') then
          insert into ts_metrics_2016_02_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-22 00:00:00-00' and new.created < TIMESTAMP '2016-02-23 00:00:00-00') then
          insert into ts_metrics_2016_02_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-23 00:00:00-00' and new.created < TIMESTAMP '2016-02-24 00:00:00-00') then
          insert into ts_metrics_2016_02_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-24 00:00:00-00' and new.created < TIMESTAMP '2016-02-25 00:00:00-00') then
          insert into ts_metrics_2016_02_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-25 00:00:00-00' and new.created < TIMESTAMP '2016-02-26 00:00:00-00') then
          insert into ts_metrics_2016_02_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-26 00:00:00-00' and new.created < TIMESTAMP '2016-02-27 00:00:00-00') then
          insert into ts_metrics_2016_02_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-27 00:00:00-00' and new.created < TIMESTAMP '2016-02-28 00:00:00-00') then
          insert into ts_metrics_2016_02_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-28 00:00:00-00' and new.created < TIMESTAMP '2016-02-29 00:00:00-00') then
          insert into ts_metrics_2016_02_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-02-29 00:00:00-00' and new.created < TIMESTAMP '2016-03-01 00:00:00-00') then
          insert into ts_metrics_2016_02_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-01 00:00:00-00' and new.created < TIMESTAMP '2016-03-02 00:00:00-00') then
          insert into ts_metrics_2016_03_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-02 00:00:00-00' and new.created < TIMESTAMP '2016-03-03 00:00:00-00') then
          insert into ts_metrics_2016_03_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-03 00:00:00-00' and new.created < TIMESTAMP '2016-03-04 00:00:00-00') then
          insert into ts_metrics_2016_03_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-04 00:00:00-00' and new.created < TIMESTAMP '2016-03-05 00:00:00-00') then
          insert into ts_metrics_2016_03_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-05 00:00:00-00' and new.created < TIMESTAMP '2016-03-06 00:00:00-00') then
          insert into ts_metrics_2016_03_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-06 00:00:00-00' and new.created < TIMESTAMP '2016-03-07 00:00:00-00') then
          insert into ts_metrics_2016_03_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-07 00:00:00-00' and new.created < TIMESTAMP '2016-03-08 00:00:00-00') then
          insert into ts_metrics_2016_03_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-08 00:00:00-00' and new.created < TIMESTAMP '2016-03-09 00:00:00-00') then
          insert into ts_metrics_2016_03_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-09 00:00:00-00' and new.created < TIMESTAMP '2016-03-10 00:00:00-00') then
          insert into ts_metrics_2016_03_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-10 00:00:00-00' and new.created < TIMESTAMP '2016-03-11 00:00:00-00') then
          insert into ts_metrics_2016_03_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-11 00:00:00-00' and new.created < TIMESTAMP '2016-03-12 00:00:00-00') then
          insert into ts_metrics_2016_03_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-12 00:00:00-00' and new.created < TIMESTAMP '2016-03-13 00:00:00-00') then
          insert into ts_metrics_2016_03_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-13 00:00:00-00' and new.created < TIMESTAMP '2016-03-14 00:00:00-00') then
          insert into ts_metrics_2016_03_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-14 00:00:00-00' and new.created < TIMESTAMP '2016-03-15 00:00:00-00') then
          insert into ts_metrics_2016_03_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-15 00:00:00-00' and new.created < TIMESTAMP '2016-03-16 00:00:00-00') then
          insert into ts_metrics_2016_03_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-16 00:00:00-00' and new.created < TIMESTAMP '2016-03-17 00:00:00-00') then
          insert into ts_metrics_2016_03_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-17 00:00:00-00' and new.created < TIMESTAMP '2016-03-18 00:00:00-00') then
          insert into ts_metrics_2016_03_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-18 00:00:00-00' and new.created < TIMESTAMP '2016-03-19 00:00:00-00') then
          insert into ts_metrics_2016_03_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-19 00:00:00-00' and new.created < TIMESTAMP '2016-03-20 00:00:00-00') then
          insert into ts_metrics_2016_03_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-20 00:00:00-00' and new.created < TIMESTAMP '2016-03-21 00:00:00-00') then
          insert into ts_metrics_2016_03_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-21 00:00:00-00' and new.created < TIMESTAMP '2016-03-22 00:00:00-00') then
          insert into ts_metrics_2016_03_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-22 00:00:00-00' and new.created < TIMESTAMP '2016-03-23 00:00:00-00') then
          insert into ts_metrics_2016_03_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-23 00:00:00-00' and new.created < TIMESTAMP '2016-03-24 00:00:00-00') then
          insert into ts_metrics_2016_03_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-24 00:00:00-00' and new.created < TIMESTAMP '2016-03-25 00:00:00-00') then
          insert into ts_metrics_2016_03_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-25 00:00:00-00' and new.created < TIMESTAMP '2016-03-26 00:00:00-00') then
          insert into ts_metrics_2016_03_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-26 00:00:00-00' and new.created < TIMESTAMP '2016-03-27 00:00:00-00') then
          insert into ts_metrics_2016_03_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-27 00:00:00-00' and new.created < TIMESTAMP '2016-03-28 00:00:00-00') then
          insert into ts_metrics_2016_03_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-28 00:00:00-00' and new.created < TIMESTAMP '2016-03-29 00:00:00-00') then
          insert into ts_metrics_2016_03_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-29 00:00:00-00' and new.created < TIMESTAMP '2016-03-30 00:00:00-00') then
          insert into ts_metrics_2016_03_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-30 00:00:00-00' and new.created < TIMESTAMP '2016-03-31 00:00:00-00') then
          insert into ts_metrics_2016_03_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-03-31 00:00:00-00' and new.created < TIMESTAMP '2016-04-01 00:00:00-00') then
          insert into ts_metrics_2016_03_31 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-01 00:00:00-00' and new.created < TIMESTAMP '2016-04-02 00:00:00-00') then
          insert into ts_metrics_2016_04_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-02 00:00:00-00' and new.created < TIMESTAMP '2016-04-03 00:00:00-00') then
          insert into ts_metrics_2016_04_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-03 00:00:00-00' and new.created < TIMESTAMP '2016-04-04 00:00:00-00') then
          insert into ts_metrics_2016_04_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-04 00:00:00-00' and new.created < TIMESTAMP '2016-04-05 00:00:00-00') then
          insert into ts_metrics_2016_04_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-05 00:00:00-00' and new.created < TIMESTAMP '2016-04-06 00:00:00-00') then
          insert into ts_metrics_2016_04_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-06 00:00:00-00' and new.created < TIMESTAMP '2016-04-07 00:00:00-00') then
          insert into ts_metrics_2016_04_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-07 00:00:00-00' and new.created < TIMESTAMP '2016-04-08 00:00:00-00') then
          insert into ts_metrics_2016_04_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-08 00:00:00-00' and new.created < TIMESTAMP '2016-04-09 00:00:00-00') then
          insert into ts_metrics_2016_04_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-09 00:00:00-00' and new.created < TIMESTAMP '2016-04-10 00:00:00-00') then
          insert into ts_metrics_2016_04_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-10 00:00:00-00' and new.created < TIMESTAMP '2016-04-11 00:00:00-00') then
          insert into ts_metrics_2016_04_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-11 00:00:00-00' and new.created < TIMESTAMP '2016-04-12 00:00:00-00') then
          insert into ts_metrics_2016_04_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-12 00:00:00-00' and new.created < TIMESTAMP '2016-04-13 00:00:00-00') then
          insert into ts_metrics_2016_04_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-13 00:00:00-00' and new.created < TIMESTAMP '2016-04-14 00:00:00-00') then
          insert into ts_metrics_2016_04_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-14 00:00:00-00' and new.created < TIMESTAMP '2016-04-15 00:00:00-00') then
          insert into ts_metrics_2016_04_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-15 00:00:00-00' and new.created < TIMESTAMP '2016-04-16 00:00:00-00') then
          insert into ts_metrics_2016_04_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-16 00:00:00-00' and new.created < TIMESTAMP '2016-04-17 00:00:00-00') then
          insert into ts_metrics_2016_04_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-17 00:00:00-00' and new.created < TIMESTAMP '2016-04-18 00:00:00-00') then
          insert into ts_metrics_2016_04_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-18 00:00:00-00' and new.created < TIMESTAMP '2016-04-19 00:00:00-00') then
          insert into ts_metrics_2016_04_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-19 00:00:00-00' and new.created < TIMESTAMP '2016-04-20 00:00:00-00') then
          insert into ts_metrics_2016_04_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-20 00:00:00-00' and new.created < TIMESTAMP '2016-04-21 00:00:00-00') then
          insert into ts_metrics_2016_04_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-21 00:00:00-00' and new.created < TIMESTAMP '2016-04-22 00:00:00-00') then
          insert into ts_metrics_2016_04_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-22 00:00:00-00' and new.created < TIMESTAMP '2016-04-23 00:00:00-00') then
          insert into ts_metrics_2016_04_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-23 00:00:00-00' and new.created < TIMESTAMP '2016-04-24 00:00:00-00') then
          insert into ts_metrics_2016_04_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-24 00:00:00-00' and new.created < TIMESTAMP '2016-04-25 00:00:00-00') then
          insert into ts_metrics_2016_04_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-25 00:00:00-00' and new.created < TIMESTAMP '2016-04-26 00:00:00-00') then
          insert into ts_metrics_2016_04_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-26 00:00:00-00' and new.created < TIMESTAMP '2016-04-27 00:00:00-00') then
          insert into ts_metrics_2016_04_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-27 00:00:00-00' and new.created < TIMESTAMP '2016-04-28 00:00:00-00') then
          insert into ts_metrics_2016_04_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-28 00:00:00-00' and new.created < TIMESTAMP '2016-04-29 00:00:00-00') then
          insert into ts_metrics_2016_04_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-29 00:00:00-00' and new.created < TIMESTAMP '2016-04-30 00:00:00-00') then
          insert into ts_metrics_2016_04_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-04-30 00:00:00-00' and new.created < TIMESTAMP '2016-05-01 00:00:00-00') then
          insert into ts_metrics_2016_04_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-01 00:00:00-00' and new.created < TIMESTAMP '2016-05-02 00:00:00-00') then
          insert into ts_metrics_2016_05_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-02 00:00:00-00' and new.created < TIMESTAMP '2016-05-03 00:00:00-00') then
          insert into ts_metrics_2016_05_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-03 00:00:00-00' and new.created < TIMESTAMP '2016-05-04 00:00:00-00') then
          insert into ts_metrics_2016_05_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-04 00:00:00-00' and new.created < TIMESTAMP '2016-05-05 00:00:00-00') then
          insert into ts_metrics_2016_05_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-05 00:00:00-00' and new.created < TIMESTAMP '2016-05-06 00:00:00-00') then
          insert into ts_metrics_2016_05_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-06 00:00:00-00' and new.created < TIMESTAMP '2016-05-07 00:00:00-00') then
          insert into ts_metrics_2016_05_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-07 00:00:00-00' and new.created < TIMESTAMP '2016-05-08 00:00:00-00') then
          insert into ts_metrics_2016_05_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-08 00:00:00-00' and new.created < TIMESTAMP '2016-05-09 00:00:00-00') then
          insert into ts_metrics_2016_05_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-09 00:00:00-00' and new.created < TIMESTAMP '2016-05-10 00:00:00-00') then
          insert into ts_metrics_2016_05_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-10 00:00:00-00' and new.created < TIMESTAMP '2016-05-11 00:00:00-00') then
          insert into ts_metrics_2016_05_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-11 00:00:00-00' and new.created < TIMESTAMP '2016-05-12 00:00:00-00') then
          insert into ts_metrics_2016_05_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-12 00:00:00-00' and new.created < TIMESTAMP '2016-05-13 00:00:00-00') then
          insert into ts_metrics_2016_05_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-13 00:00:00-00' and new.created < TIMESTAMP '2016-05-14 00:00:00-00') then
          insert into ts_metrics_2016_05_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-14 00:00:00-00' and new.created < TIMESTAMP '2016-05-15 00:00:00-00') then
          insert into ts_metrics_2016_05_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-15 00:00:00-00' and new.created < TIMESTAMP '2016-05-16 00:00:00-00') then
          insert into ts_metrics_2016_05_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-16 00:00:00-00' and new.created < TIMESTAMP '2016-05-17 00:00:00-00') then
          insert into ts_metrics_2016_05_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-17 00:00:00-00' and new.created < TIMESTAMP '2016-05-18 00:00:00-00') then
          insert into ts_metrics_2016_05_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-18 00:00:00-00' and new.created < TIMESTAMP '2016-05-19 00:00:00-00') then
          insert into ts_metrics_2016_05_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-19 00:00:00-00' and new.created < TIMESTAMP '2016-05-20 00:00:00-00') then
          insert into ts_metrics_2016_05_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-20 00:00:00-00' and new.created < TIMESTAMP '2016-05-21 00:00:00-00') then
          insert into ts_metrics_2016_05_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-21 00:00:00-00' and new.created < TIMESTAMP '2016-05-22 00:00:00-00') then
          insert into ts_metrics_2016_05_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-22 00:00:00-00' and new.created < TIMESTAMP '2016-05-23 00:00:00-00') then
          insert into ts_metrics_2016_05_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-23 00:00:00-00' and new.created < TIMESTAMP '2016-05-24 00:00:00-00') then
          insert into ts_metrics_2016_05_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-24 00:00:00-00' and new.created < TIMESTAMP '2016-05-25 00:00:00-00') then
          insert into ts_metrics_2016_05_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-25 00:00:00-00' and new.created < TIMESTAMP '2016-05-26 00:00:00-00') then
          insert into ts_metrics_2016_05_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-26 00:00:00-00' and new.created < TIMESTAMP '2016-05-27 00:00:00-00') then
          insert into ts_metrics_2016_05_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-27 00:00:00-00' and new.created < TIMESTAMP '2016-05-28 00:00:00-00') then
          insert into ts_metrics_2016_05_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-28 00:00:00-00' and new.created < TIMESTAMP '2016-05-29 00:00:00-00') then
          insert into ts_metrics_2016_05_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-29 00:00:00-00' and new.created < TIMESTAMP '2016-05-30 00:00:00-00') then
          insert into ts_metrics_2016_05_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-30 00:00:00-00' and new.created < TIMESTAMP '2016-05-31 00:00:00-00') then
          insert into ts_metrics_2016_05_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-05-31 00:00:00-00' and new.created < TIMESTAMP '2016-06-01 00:00:00-00') then
          insert into ts_metrics_2016_05_31 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-01 00:00:00-00' and new.created < TIMESTAMP '2016-06-02 00:00:00-00') then
          insert into ts_metrics_2016_06_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-02 00:00:00-00' and new.created < TIMESTAMP '2016-06-03 00:00:00-00') then
          insert into ts_metrics_2016_06_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-03 00:00:00-00' and new.created < TIMESTAMP '2016-06-04 00:00:00-00') then
          insert into ts_metrics_2016_06_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-04 00:00:00-00' and new.created < TIMESTAMP '2016-06-05 00:00:00-00') then
          insert into ts_metrics_2016_06_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-05 00:00:00-00' and new.created < TIMESTAMP '2016-06-06 00:00:00-00') then
          insert into ts_metrics_2016_06_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-06 00:00:00-00' and new.created < TIMESTAMP '2016-06-07 00:00:00-00') then
          insert into ts_metrics_2016_06_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-07 00:00:00-00' and new.created < TIMESTAMP '2016-06-08 00:00:00-00') then
          insert into ts_metrics_2016_06_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-08 00:00:00-00' and new.created < TIMESTAMP '2016-06-09 00:00:00-00') then
          insert into ts_metrics_2016_06_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-09 00:00:00-00' and new.created < TIMESTAMP '2016-06-10 00:00:00-00') then
          insert into ts_metrics_2016_06_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-10 00:00:00-00' and new.created < TIMESTAMP '2016-06-11 00:00:00-00') then
          insert into ts_metrics_2016_06_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-11 00:00:00-00' and new.created < TIMESTAMP '2016-06-12 00:00:00-00') then
          insert into ts_metrics_2016_06_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-12 00:00:00-00' and new.created < TIMESTAMP '2016-06-13 00:00:00-00') then
          insert into ts_metrics_2016_06_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-13 00:00:00-00' and new.created < TIMESTAMP '2016-06-14 00:00:00-00') then
          insert into ts_metrics_2016_06_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-14 00:00:00-00' and new.created < TIMESTAMP '2016-06-15 00:00:00-00') then
          insert into ts_metrics_2016_06_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-15 00:00:00-00' and new.created < TIMESTAMP '2016-06-16 00:00:00-00') then
          insert into ts_metrics_2016_06_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-16 00:00:00-00' and new.created < TIMESTAMP '2016-06-17 00:00:00-00') then
          insert into ts_metrics_2016_06_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-17 00:00:00-00' and new.created < TIMESTAMP '2016-06-18 00:00:00-00') then
          insert into ts_metrics_2016_06_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-18 00:00:00-00' and new.created < TIMESTAMP '2016-06-19 00:00:00-00') then
          insert into ts_metrics_2016_06_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-19 00:00:00-00' and new.created < TIMESTAMP '2016-06-20 00:00:00-00') then
          insert into ts_metrics_2016_06_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-20 00:00:00-00' and new.created < TIMESTAMP '2016-06-21 00:00:00-00') then
          insert into ts_metrics_2016_06_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-21 00:00:00-00' and new.created < TIMESTAMP '2016-06-22 00:00:00-00') then
          insert into ts_metrics_2016_06_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-22 00:00:00-00' and new.created < TIMESTAMP '2016-06-23 00:00:00-00') then
          insert into ts_metrics_2016_06_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-23 00:00:00-00' and new.created < TIMESTAMP '2016-06-24 00:00:00-00') then
          insert into ts_metrics_2016_06_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-24 00:00:00-00' and new.created < TIMESTAMP '2016-06-25 00:00:00-00') then
          insert into ts_metrics_2016_06_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-25 00:00:00-00' and new.created < TIMESTAMP '2016-06-26 00:00:00-00') then
          insert into ts_metrics_2016_06_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-26 00:00:00-00' and new.created < TIMESTAMP '2016-06-27 00:00:00-00') then
          insert into ts_metrics_2016_06_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-27 00:00:00-00' and new.created < TIMESTAMP '2016-06-28 00:00:00-00') then
          insert into ts_metrics_2016_06_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-28 00:00:00-00' and new.created < TIMESTAMP '2016-06-29 00:00:00-00') then
          insert into ts_metrics_2016_06_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-29 00:00:00-00' and new.created < TIMESTAMP '2016-06-30 00:00:00-00') then
          insert into ts_metrics_2016_06_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-06-30 00:00:00-00' and new.created < TIMESTAMP '2016-07-01 00:00:00-00') then
          insert into ts_metrics_2016_06_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-01 00:00:00-00' and new.created < TIMESTAMP '2016-07-02 00:00:00-00') then
          insert into ts_metrics_2016_07_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-02 00:00:00-00' and new.created < TIMESTAMP '2016-07-03 00:00:00-00') then
          insert into ts_metrics_2016_07_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-03 00:00:00-00' and new.created < TIMESTAMP '2016-07-04 00:00:00-00') then
          insert into ts_metrics_2016_07_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-04 00:00:00-00' and new.created < TIMESTAMP '2016-07-05 00:00:00-00') then
          insert into ts_metrics_2016_07_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-05 00:00:00-00' and new.created < TIMESTAMP '2016-07-06 00:00:00-00') then
          insert into ts_metrics_2016_07_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-06 00:00:00-00' and new.created < TIMESTAMP '2016-07-07 00:00:00-00') then
          insert into ts_metrics_2016_07_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-07 00:00:00-00' and new.created < TIMESTAMP '2016-07-08 00:00:00-00') then
          insert into ts_metrics_2016_07_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-08 00:00:00-00' and new.created < TIMESTAMP '2016-07-09 00:00:00-00') then
          insert into ts_metrics_2016_07_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-09 00:00:00-00' and new.created < TIMESTAMP '2016-07-10 00:00:00-00') then
          insert into ts_metrics_2016_07_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-10 00:00:00-00' and new.created < TIMESTAMP '2016-07-11 00:00:00-00') then
          insert into ts_metrics_2016_07_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-11 00:00:00-00' and new.created < TIMESTAMP '2016-07-12 00:00:00-00') then
          insert into ts_metrics_2016_07_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-12 00:00:00-00' and new.created < TIMESTAMP '2016-07-13 00:00:00-00') then
          insert into ts_metrics_2016_07_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-13 00:00:00-00' and new.created < TIMESTAMP '2016-07-14 00:00:00-00') then
          insert into ts_metrics_2016_07_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-14 00:00:00-00' and new.created < TIMESTAMP '2016-07-15 00:00:00-00') then
          insert into ts_metrics_2016_07_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-15 00:00:00-00' and new.created < TIMESTAMP '2016-07-16 00:00:00-00') then
          insert into ts_metrics_2016_07_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-16 00:00:00-00' and new.created < TIMESTAMP '2016-07-17 00:00:00-00') then
          insert into ts_metrics_2016_07_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-17 00:00:00-00' and new.created < TIMESTAMP '2016-07-18 00:00:00-00') then
          insert into ts_metrics_2016_07_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-18 00:00:00-00' and new.created < TIMESTAMP '2016-07-19 00:00:00-00') then
          insert into ts_metrics_2016_07_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-19 00:00:00-00' and new.created < TIMESTAMP '2016-07-20 00:00:00-00') then
          insert into ts_metrics_2016_07_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-20 00:00:00-00' and new.created < TIMESTAMP '2016-07-21 00:00:00-00') then
          insert into ts_metrics_2016_07_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-21 00:00:00-00' and new.created < TIMESTAMP '2016-07-22 00:00:00-00') then
          insert into ts_metrics_2016_07_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-22 00:00:00-00' and new.created < TIMESTAMP '2016-07-23 00:00:00-00') then
          insert into ts_metrics_2016_07_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-23 00:00:00-00' and new.created < TIMESTAMP '2016-07-24 00:00:00-00') then
          insert into ts_metrics_2016_07_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-24 00:00:00-00' and new.created < TIMESTAMP '2016-07-25 00:00:00-00') then
          insert into ts_metrics_2016_07_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-25 00:00:00-00' and new.created < TIMESTAMP '2016-07-26 00:00:00-00') then
          insert into ts_metrics_2016_07_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-26 00:00:00-00' and new.created < TIMESTAMP '2016-07-27 00:00:00-00') then
          insert into ts_metrics_2016_07_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-27 00:00:00-00' and new.created < TIMESTAMP '2016-07-28 00:00:00-00') then
          insert into ts_metrics_2016_07_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-28 00:00:00-00' and new.created < TIMESTAMP '2016-07-29 00:00:00-00') then
          insert into ts_metrics_2016_07_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-29 00:00:00-00' and new.created < TIMESTAMP '2016-07-30 00:00:00-00') then
          insert into ts_metrics_2016_07_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-30 00:00:00-00' and new.created < TIMESTAMP '2016-07-31 00:00:00-00') then
          insert into ts_metrics_2016_07_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-07-31 00:00:00-00' and new.created < TIMESTAMP '2016-08-01 00:00:00-00') then
          insert into ts_metrics_2016_07_31 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-01 00:00:00-00' and new.created < TIMESTAMP '2016-08-02 00:00:00-00') then
          insert into ts_metrics_2016_08_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-02 00:00:00-00' and new.created < TIMESTAMP '2016-08-03 00:00:00-00') then
          insert into ts_metrics_2016_08_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-03 00:00:00-00' and new.created < TIMESTAMP '2016-08-04 00:00:00-00') then
          insert into ts_metrics_2016_08_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-04 00:00:00-00' and new.created < TIMESTAMP '2016-08-05 00:00:00-00') then
          insert into ts_metrics_2016_08_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-05 00:00:00-00' and new.created < TIMESTAMP '2016-08-06 00:00:00-00') then
          insert into ts_metrics_2016_08_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-06 00:00:00-00' and new.created < TIMESTAMP '2016-08-07 00:00:00-00') then
          insert into ts_metrics_2016_08_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-07 00:00:00-00' and new.created < TIMESTAMP '2016-08-08 00:00:00-00') then
          insert into ts_metrics_2016_08_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-08 00:00:00-00' and new.created < TIMESTAMP '2016-08-09 00:00:00-00') then
          insert into ts_metrics_2016_08_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-09 00:00:00-00' and new.created < TIMESTAMP '2016-08-10 00:00:00-00') then
          insert into ts_metrics_2016_08_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-10 00:00:00-00' and new.created < TIMESTAMP '2016-08-11 00:00:00-00') then
          insert into ts_metrics_2016_08_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-11 00:00:00-00' and new.created < TIMESTAMP '2016-08-12 00:00:00-00') then
          insert into ts_metrics_2016_08_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-12 00:00:00-00' and new.created < TIMESTAMP '2016-08-13 00:00:00-00') then
          insert into ts_metrics_2016_08_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-13 00:00:00-00' and new.created < TIMESTAMP '2016-08-14 00:00:00-00') then
          insert into ts_metrics_2016_08_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-14 00:00:00-00' and new.created < TIMESTAMP '2016-08-15 00:00:00-00') then
          insert into ts_metrics_2016_08_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-15 00:00:00-00' and new.created < TIMESTAMP '2016-08-16 00:00:00-00') then
          insert into ts_metrics_2016_08_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-16 00:00:00-00' and new.created < TIMESTAMP '2016-08-17 00:00:00-00') then
          insert into ts_metrics_2016_08_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-17 00:00:00-00' and new.created < TIMESTAMP '2016-08-18 00:00:00-00') then
          insert into ts_metrics_2016_08_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-18 00:00:00-00' and new.created < TIMESTAMP '2016-08-19 00:00:00-00') then
          insert into ts_metrics_2016_08_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-19 00:00:00-00' and new.created < TIMESTAMP '2016-08-20 00:00:00-00') then
          insert into ts_metrics_2016_08_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-20 00:00:00-00' and new.created < TIMESTAMP '2016-08-21 00:00:00-00') then
          insert into ts_metrics_2016_08_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-21 00:00:00-00' and new.created < TIMESTAMP '2016-08-22 00:00:00-00') then
          insert into ts_metrics_2016_08_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-22 00:00:00-00' and new.created < TIMESTAMP '2016-08-23 00:00:00-00') then
          insert into ts_metrics_2016_08_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-23 00:00:00-00' and new.created < TIMESTAMP '2016-08-24 00:00:00-00') then
          insert into ts_metrics_2016_08_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-24 00:00:00-00' and new.created < TIMESTAMP '2016-08-25 00:00:00-00') then
          insert into ts_metrics_2016_08_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-25 00:00:00-00' and new.created < TIMESTAMP '2016-08-26 00:00:00-00') then
          insert into ts_metrics_2016_08_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-26 00:00:00-00' and new.created < TIMESTAMP '2016-08-27 00:00:00-00') then
          insert into ts_metrics_2016_08_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-27 00:00:00-00' and new.created < TIMESTAMP '2016-08-28 00:00:00-00') then
          insert into ts_metrics_2016_08_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-28 00:00:00-00' and new.created < TIMESTAMP '2016-08-29 00:00:00-00') then
          insert into ts_metrics_2016_08_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-29 00:00:00-00' and new.created < TIMESTAMP '2016-08-30 00:00:00-00') then
          insert into ts_metrics_2016_08_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-30 00:00:00-00' and new.created < TIMESTAMP '2016-08-31 00:00:00-00') then
          insert into ts_metrics_2016_08_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-08-31 00:00:00-00' and new.created < TIMESTAMP '2016-09-01 00:00:00-00') then
          insert into ts_metrics_2016_08_31 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-01 00:00:00-00' and new.created < TIMESTAMP '2016-09-02 00:00:00-00') then
          insert into ts_metrics_2016_09_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-02 00:00:00-00' and new.created < TIMESTAMP '2016-09-03 00:00:00-00') then
          insert into ts_metrics_2016_09_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-03 00:00:00-00' and new.created < TIMESTAMP '2016-09-04 00:00:00-00') then
          insert into ts_metrics_2016_09_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-04 00:00:00-00' and new.created < TIMESTAMP '2016-09-05 00:00:00-00') then
          insert into ts_metrics_2016_09_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-05 00:00:00-00' and new.created < TIMESTAMP '2016-09-06 00:00:00-00') then
          insert into ts_metrics_2016_09_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-06 00:00:00-00' and new.created < TIMESTAMP '2016-09-07 00:00:00-00') then
          insert into ts_metrics_2016_09_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-07 00:00:00-00' and new.created < TIMESTAMP '2016-09-08 00:00:00-00') then
          insert into ts_metrics_2016_09_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-08 00:00:00-00' and new.created < TIMESTAMP '2016-09-09 00:00:00-00') then
          insert into ts_metrics_2016_09_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-09 00:00:00-00' and new.created < TIMESTAMP '2016-09-10 00:00:00-00') then
          insert into ts_metrics_2016_09_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-10 00:00:00-00' and new.created < TIMESTAMP '2016-09-11 00:00:00-00') then
          insert into ts_metrics_2016_09_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-11 00:00:00-00' and new.created < TIMESTAMP '2016-09-12 00:00:00-00') then
          insert into ts_metrics_2016_09_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-12 00:00:00-00' and new.created < TIMESTAMP '2016-09-13 00:00:00-00') then
          insert into ts_metrics_2016_09_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-13 00:00:00-00' and new.created < TIMESTAMP '2016-09-14 00:00:00-00') then
          insert into ts_metrics_2016_09_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-14 00:00:00-00' and new.created < TIMESTAMP '2016-09-15 00:00:00-00') then
          insert into ts_metrics_2016_09_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-15 00:00:00-00' and new.created < TIMESTAMP '2016-09-16 00:00:00-00') then
          insert into ts_metrics_2016_09_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-16 00:00:00-00' and new.created < TIMESTAMP '2016-09-17 00:00:00-00') then
          insert into ts_metrics_2016_09_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-17 00:00:00-00' and new.created < TIMESTAMP '2016-09-18 00:00:00-00') then
          insert into ts_metrics_2016_09_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-18 00:00:00-00' and new.created < TIMESTAMP '2016-09-19 00:00:00-00') then
          insert into ts_metrics_2016_09_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-19 00:00:00-00' and new.created < TIMESTAMP '2016-09-20 00:00:00-00') then
          insert into ts_metrics_2016_09_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-20 00:00:00-00' and new.created < TIMESTAMP '2016-09-21 00:00:00-00') then
          insert into ts_metrics_2016_09_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-21 00:00:00-00' and new.created < TIMESTAMP '2016-09-22 00:00:00-00') then
          insert into ts_metrics_2016_09_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-22 00:00:00-00' and new.created < TIMESTAMP '2016-09-23 00:00:00-00') then
          insert into ts_metrics_2016_09_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-23 00:00:00-00' and new.created < TIMESTAMP '2016-09-24 00:00:00-00') then
          insert into ts_metrics_2016_09_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-24 00:00:00-00' and new.created < TIMESTAMP '2016-09-25 00:00:00-00') then
          insert into ts_metrics_2016_09_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-25 00:00:00-00' and new.created < TIMESTAMP '2016-09-26 00:00:00-00') then
          insert into ts_metrics_2016_09_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-26 00:00:00-00' and new.created < TIMESTAMP '2016-09-27 00:00:00-00') then
          insert into ts_metrics_2016_09_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-27 00:00:00-00' and new.created < TIMESTAMP '2016-09-28 00:00:00-00') then
          insert into ts_metrics_2016_09_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-28 00:00:00-00' and new.created < TIMESTAMP '2016-09-29 00:00:00-00') then
          insert into ts_metrics_2016_09_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-29 00:00:00-00' and new.created < TIMESTAMP '2016-09-30 00:00:00-00') then
          insert into ts_metrics_2016_09_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-09-30 00:00:00-00' and new.created < TIMESTAMP '2016-10-01 00:00:00-00') then
          insert into ts_metrics_2016_09_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-01 00:00:00-00' and new.created < TIMESTAMP '2016-10-02 00:00:00-00') then
          insert into ts_metrics_2016_10_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-02 00:00:00-00' and new.created < TIMESTAMP '2016-10-03 00:00:00-00') then
          insert into ts_metrics_2016_10_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-03 00:00:00-00' and new.created < TIMESTAMP '2016-10-04 00:00:00-00') then
          insert into ts_metrics_2016_10_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-04 00:00:00-00' and new.created < TIMESTAMP '2016-10-05 00:00:00-00') then
          insert into ts_metrics_2016_10_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-05 00:00:00-00' and new.created < TIMESTAMP '2016-10-06 00:00:00-00') then
          insert into ts_metrics_2016_10_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-06 00:00:00-00' and new.created < TIMESTAMP '2016-10-07 00:00:00-00') then
          insert into ts_metrics_2016_10_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-07 00:00:00-00' and new.created < TIMESTAMP '2016-10-08 00:00:00-00') then
          insert into ts_metrics_2016_10_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-08 00:00:00-00' and new.created < TIMESTAMP '2016-10-09 00:00:00-00') then
          insert into ts_metrics_2016_10_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-09 00:00:00-00' and new.created < TIMESTAMP '2016-10-10 00:00:00-00') then
          insert into ts_metrics_2016_10_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-10 00:00:00-00' and new.created < TIMESTAMP '2016-10-11 00:00:00-00') then
          insert into ts_metrics_2016_10_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-11 00:00:00-00' and new.created < TIMESTAMP '2016-10-12 00:00:00-00') then
          insert into ts_metrics_2016_10_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-12 00:00:00-00' and new.created < TIMESTAMP '2016-10-13 00:00:00-00') then
          insert into ts_metrics_2016_10_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-13 00:00:00-00' and new.created < TIMESTAMP '2016-10-14 00:00:00-00') then
          insert into ts_metrics_2016_10_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-14 00:00:00-00' and new.created < TIMESTAMP '2016-10-15 00:00:00-00') then
          insert into ts_metrics_2016_10_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-15 00:00:00-00' and new.created < TIMESTAMP '2016-10-16 00:00:00-00') then
          insert into ts_metrics_2016_10_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-16 00:00:00-00' and new.created < TIMESTAMP '2016-10-17 00:00:00-00') then
          insert into ts_metrics_2016_10_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-17 00:00:00-00' and new.created < TIMESTAMP '2016-10-18 00:00:00-00') then
          insert into ts_metrics_2016_10_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-18 00:00:00-00' and new.created < TIMESTAMP '2016-10-19 00:00:00-00') then
          insert into ts_metrics_2016_10_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-19 00:00:00-00' and new.created < TIMESTAMP '2016-10-20 00:00:00-00') then
          insert into ts_metrics_2016_10_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-20 00:00:00-00' and new.created < TIMESTAMP '2016-10-21 00:00:00-00') then
          insert into ts_metrics_2016_10_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-21 00:00:00-00' and new.created < TIMESTAMP '2016-10-22 00:00:00-00') then
          insert into ts_metrics_2016_10_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-22 00:00:00-00' and new.created < TIMESTAMP '2016-10-23 00:00:00-00') then
          insert into ts_metrics_2016_10_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-23 00:00:00-00' and new.created < TIMESTAMP '2016-10-24 00:00:00-00') then
          insert into ts_metrics_2016_10_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-24 00:00:00-00' and new.created < TIMESTAMP '2016-10-25 00:00:00-00') then
          insert into ts_metrics_2016_10_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-25 00:00:00-00' and new.created < TIMESTAMP '2016-10-26 00:00:00-00') then
          insert into ts_metrics_2016_10_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-26 00:00:00-00' and new.created < TIMESTAMP '2016-10-27 00:00:00-00') then
          insert into ts_metrics_2016_10_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-27 00:00:00-00' and new.created < TIMESTAMP '2016-10-28 00:00:00-00') then
          insert into ts_metrics_2016_10_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-28 00:00:00-00' and new.created < TIMESTAMP '2016-10-29 00:00:00-00') then
          insert into ts_metrics_2016_10_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-29 00:00:00-00' and new.created < TIMESTAMP '2016-10-30 00:00:00-00') then
          insert into ts_metrics_2016_10_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-30 00:00:00-00' and new.created < TIMESTAMP '2016-10-31 00:00:00-00') then
          insert into ts_metrics_2016_10_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-10-31 00:00:00-00' and new.created < TIMESTAMP '2016-11-01 00:00:00-00') then
          insert into ts_metrics_2016_10_31 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-01 00:00:00-00' and new.created < TIMESTAMP '2016-11-02 00:00:00-00') then
          insert into ts_metrics_2016_11_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-02 00:00:00-00' and new.created < TIMESTAMP '2016-11-03 00:00:00-00') then
          insert into ts_metrics_2016_11_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-03 00:00:00-00' and new.created < TIMESTAMP '2016-11-04 00:00:00-00') then
          insert into ts_metrics_2016_11_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-04 00:00:00-00' and new.created < TIMESTAMP '2016-11-05 00:00:00-00') then
          insert into ts_metrics_2016_11_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-05 00:00:00-00' and new.created < TIMESTAMP '2016-11-06 00:00:00-00') then
          insert into ts_metrics_2016_11_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-06 00:00:00-00' and new.created < TIMESTAMP '2016-11-07 00:00:00-00') then
          insert into ts_metrics_2016_11_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-07 00:00:00-00' and new.created < TIMESTAMP '2016-11-08 00:00:00-00') then
          insert into ts_metrics_2016_11_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-08 00:00:00-00' and new.created < TIMESTAMP '2016-11-09 00:00:00-00') then
          insert into ts_metrics_2016_11_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-09 00:00:00-00' and new.created < TIMESTAMP '2016-11-10 00:00:00-00') then
          insert into ts_metrics_2016_11_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-10 00:00:00-00' and new.created < TIMESTAMP '2016-11-11 00:00:00-00') then
          insert into ts_metrics_2016_11_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-11 00:00:00-00' and new.created < TIMESTAMP '2016-11-12 00:00:00-00') then
          insert into ts_metrics_2016_11_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-12 00:00:00-00' and new.created < TIMESTAMP '2016-11-13 00:00:00-00') then
          insert into ts_metrics_2016_11_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-13 00:00:00-00' and new.created < TIMESTAMP '2016-11-14 00:00:00-00') then
          insert into ts_metrics_2016_11_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-14 00:00:00-00' and new.created < TIMESTAMP '2016-11-15 00:00:00-00') then
          insert into ts_metrics_2016_11_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-15 00:00:00-00' and new.created < TIMESTAMP '2016-11-16 00:00:00-00') then
          insert into ts_metrics_2016_11_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-16 00:00:00-00' and new.created < TIMESTAMP '2016-11-17 00:00:00-00') then
          insert into ts_metrics_2016_11_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-17 00:00:00-00' and new.created < TIMESTAMP '2016-11-18 00:00:00-00') then
          insert into ts_metrics_2016_11_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-18 00:00:00-00' and new.created < TIMESTAMP '2016-11-19 00:00:00-00') then
          insert into ts_metrics_2016_11_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-19 00:00:00-00' and new.created < TIMESTAMP '2016-11-20 00:00:00-00') then
          insert into ts_metrics_2016_11_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-20 00:00:00-00' and new.created < TIMESTAMP '2016-11-21 00:00:00-00') then
          insert into ts_metrics_2016_11_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-21 00:00:00-00' and new.created < TIMESTAMP '2016-11-22 00:00:00-00') then
          insert into ts_metrics_2016_11_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-22 00:00:00-00' and new.created < TIMESTAMP '2016-11-23 00:00:00-00') then
          insert into ts_metrics_2016_11_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-23 00:00:00-00' and new.created < TIMESTAMP '2016-11-24 00:00:00-00') then
          insert into ts_metrics_2016_11_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-24 00:00:00-00' and new.created < TIMESTAMP '2016-11-25 00:00:00-00') then
          insert into ts_metrics_2016_11_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-25 00:00:00-00' and new.created < TIMESTAMP '2016-11-26 00:00:00-00') then
          insert into ts_metrics_2016_11_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-26 00:00:00-00' and new.created < TIMESTAMP '2016-11-27 00:00:00-00') then
          insert into ts_metrics_2016_11_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-27 00:00:00-00' and new.created < TIMESTAMP '2016-11-28 00:00:00-00') then
          insert into ts_metrics_2016_11_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-28 00:00:00-00' and new.created < TIMESTAMP '2016-11-29 00:00:00-00') then
          insert into ts_metrics_2016_11_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-29 00:00:00-00' and new.created < TIMESTAMP '2016-11-30 00:00:00-00') then
          insert into ts_metrics_2016_11_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-11-30 00:00:00-00' and new.created < TIMESTAMP '2016-12-01 00:00:00-00') then
          insert into ts_metrics_2016_11_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-01 00:00:00-00' and new.created < TIMESTAMP '2016-12-02 00:00:00-00') then
          insert into ts_metrics_2016_12_01 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-02 00:00:00-00' and new.created < TIMESTAMP '2016-12-03 00:00:00-00') then
          insert into ts_metrics_2016_12_02 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-03 00:00:00-00' and new.created < TIMESTAMP '2016-12-04 00:00:00-00') then
          insert into ts_metrics_2016_12_03 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-04 00:00:00-00' and new.created < TIMESTAMP '2016-12-05 00:00:00-00') then
          insert into ts_metrics_2016_12_04 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-05 00:00:00-00' and new.created < TIMESTAMP '2016-12-06 00:00:00-00') then
          insert into ts_metrics_2016_12_05 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-06 00:00:00-00' and new.created < TIMESTAMP '2016-12-07 00:00:00-00') then
          insert into ts_metrics_2016_12_06 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-07 00:00:00-00' and new.created < TIMESTAMP '2016-12-08 00:00:00-00') then
          insert into ts_metrics_2016_12_07 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-08 00:00:00-00' and new.created < TIMESTAMP '2016-12-09 00:00:00-00') then
          insert into ts_metrics_2016_12_08 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-09 00:00:00-00' and new.created < TIMESTAMP '2016-12-10 00:00:00-00') then
          insert into ts_metrics_2016_12_09 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-10 00:00:00-00' and new.created < TIMESTAMP '2016-12-11 00:00:00-00') then
          insert into ts_metrics_2016_12_10 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-11 00:00:00-00' and new.created < TIMESTAMP '2016-12-12 00:00:00-00') then
          insert into ts_metrics_2016_12_11 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-12 00:00:00-00' and new.created < TIMESTAMP '2016-12-13 00:00:00-00') then
          insert into ts_metrics_2016_12_12 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-13 00:00:00-00' and new.created < TIMESTAMP '2016-12-14 00:00:00-00') then
          insert into ts_metrics_2016_12_13 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-14 00:00:00-00' and new.created < TIMESTAMP '2016-12-15 00:00:00-00') then
          insert into ts_metrics_2016_12_14 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-15 00:00:00-00' and new.created < TIMESTAMP '2016-12-16 00:00:00-00') then
          insert into ts_metrics_2016_12_15 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-16 00:00:00-00' and new.created < TIMESTAMP '2016-12-17 00:00:00-00') then
          insert into ts_metrics_2016_12_16 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-17 00:00:00-00' and new.created < TIMESTAMP '2016-12-18 00:00:00-00') then
          insert into ts_metrics_2016_12_17 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-18 00:00:00-00' and new.created < TIMESTAMP '2016-12-19 00:00:00-00') then
          insert into ts_metrics_2016_12_18 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-19 00:00:00-00' and new.created < TIMESTAMP '2016-12-20 00:00:00-00') then
          insert into ts_metrics_2016_12_19 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-20 00:00:00-00' and new.created < TIMESTAMP '2016-12-21 00:00:00-00') then
          insert into ts_metrics_2016_12_20 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-21 00:00:00-00' and new.created < TIMESTAMP '2016-12-22 00:00:00-00') then
          insert into ts_metrics_2016_12_21 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-22 00:00:00-00' and new.created < TIMESTAMP '2016-12-23 00:00:00-00') then
          insert into ts_metrics_2016_12_22 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-23 00:00:00-00' and new.created < TIMESTAMP '2016-12-24 00:00:00-00') then
          insert into ts_metrics_2016_12_23 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-24 00:00:00-00' and new.created < TIMESTAMP '2016-12-25 00:00:00-00') then
          insert into ts_metrics_2016_12_24 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-25 00:00:00-00' and new.created < TIMESTAMP '2016-12-26 00:00:00-00') then
          insert into ts_metrics_2016_12_25 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-26 00:00:00-00' and new.created < TIMESTAMP '2016-12-27 00:00:00-00') then
          insert into ts_metrics_2016_12_26 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-27 00:00:00-00' and new.created < TIMESTAMP '2016-12-28 00:00:00-00') then
          insert into ts_metrics_2016_12_27 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-28 00:00:00-00' and new.created < TIMESTAMP '2016-12-29 00:00:00-00') then
          insert into ts_metrics_2016_12_28 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-29 00:00:00-00' and new.created < TIMESTAMP '2016-12-30 00:00:00-00') then
          insert into ts_metrics_2016_12_29 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-30 00:00:00-00' and new.created < TIMESTAMP '2016-12-31 00:00:00-00') then
          insert into ts_metrics_2016_12_30 values (new.*);
      elsif ( new.created >= TIMESTAMP '2016-12-31 00:00:00-00' and new.created < TIMESTAMP '2017-01-01 00:00:00-00') then
          insert into ts_metrics_2016_12_31 values (new.*);
      end if;
  
      return null;
  end;
  $$ language plpgsql;
  
  DO
  $$
  BEGIN
      IF NOT EXISTS(SELECT * FROM information_schema.triggers  WHERE event_object_table = 'ts_metrics' AND trigger_name = 'trigger_on_ts_metrics_insert_2016') THEN
          create trigger trigger_on_ts_metrics_insert_2016
              before insert on ts_metrics
              for each row execute procedure on_ts_metrics_insert_2016();
      END IF;
  END;
  $$
  
  
  
  