"Fossies" - the Fresh Open Source Software Archive

Member "monasca-api-3.1.0/java/src/test/resources/monasca/api/infrastructure/persistence/vertica/metrics.sql" (27 Sep 2019, 1976 Bytes) of package /linux/misc/openstack/monasca-api-3.1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PL/SQL source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 CREATE SCHEMA MonMetrics;
    2 
    3 CREATE TABLE MonMetrics.Measurements (
    4     id AUTO_INCREMENT,
    5     metric_definition_id BINARY(20) NOT NULL,
    6     time_stamp TIMESTAMP NOT NULL,
    7     value FLOAT NOT NULL,
    8     PRIMARY KEY(id)
    9 ) PARTITION BY EXTRACT('year' FROM time_stamp)*10000 + EXTRACT('month' FROM time_stamp)*100 + EXTRACT('day' FROM time_stamp);
   10 
   11 CREATE TABLE MonMetrics.Definitions (
   12     id BINARY(20) NOT NULL,
   13     name VARCHAR NOT NULL,
   14     tenant_id VARCHAR(14) NOT NULL,
   15     region VARCHAR NOT NULL,
   16     PRIMARY KEY(id),
   17     CONSTRAINT MetricsDefinitionsConstraint UNIQUE(id, name, tenant_id, region)
   18 );
   19 
   20 CREATE TABLE MonMetrics.Dimensions (
   21     metric_definition_id BINARY(20) NOT NULL,
   22     name VARCHAR NOT NULL,
   23     value VARCHAR NOT NULL,
   24     CONSTRAINT MetricsDimensionsConstraint UNIQUE(metric_definition_id, name, value)
   25 );
   26 
   27 CREATE PROJECTION Measurements_DBD_1_rep_MonMetrics /*+createtype(D)*/
   28 (
   29  id ENCODING AUTO, 
   30  metric_definition_id ENCODING RLE, 
   31  time_stamp ENCODING DELTAVAL, 
   32  value ENCODING AUTO
   33 )
   34 AS
   35  SELECT id, 
   36         metric_definition_id, 
   37         time_stamp, 
   38         value
   39  FROM MonMetrics.Measurements 
   40  ORDER BY metric_definition_id,
   41           time_stamp,
   42           id
   43 UNSEGMENTED ALL NODES;
   44 
   45 CREATE PROJECTION Definitions_DBD_2_rep_MonMetrics /*+createtype(D)*/
   46 (
   47  id ENCODING RLE, 
   48  name ENCODING AUTO,
   49  tenant_id ENCODING RLE, 
   50  region ENCODING RLE
   51 )
   52 AS
   53  SELECT id, 
   54         name, 
   55         tenant_id, 
   56         region
   57  FROM MonMetrics.Definitions 
   58  ORDER BY id,
   59           tenant_id,
   60           region,
   61           name
   62 UNSEGMENTED ALL NODES;
   63 
   64 CREATE PROJECTION Dimensions_DBD_4_rep_MonMetrics /*+createtype(D)*/
   65 (
   66  metric_definition_id ENCODING RLE, 
   67  name ENCODING AUTO, 
   68  value ENCODING AUTO
   69 )
   70 AS
   71  SELECT metric_definition_id, 
   72         name, 
   73         value
   74  FROM MonMetrics.Dimensions 
   75  ORDER BY metric_definition_id,
   76           name
   77 UNSEGMENTED ALL NODES;
   78 
   79 select refresh('MonMetrics.Measurements, MonMetrics.Definitions, MonMetrics.Dimensions');