create table VPX_DVS_PVLAN (
   DVS_ID                   BIGINT         not null,
   PRIMARY_VLANID           INTEGER         not null,
   SECONDARY_VLANID         INTEGER         not null,
   PVLAN_TYPE               VARCHAR(50)     not null,
   SURR_KEY					SERIAL,
   constraint PK_VPX_DVS_PVLAN primary key (DVS_ID,SURR_KEY),
   constraint FK_VPX_DVS_PVLAN_REF_VPX_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/* Index for VpxdSqlList.cpp "GetVlanIdReferredInDvs2" */
CREATE INDEX VPX_DVS_PVLAN_F1 ON VPX_DVS_PVLAN(DVS_ID, SECONDARY_VLANID);


/*==============================================================*/
/* Table: VPX_DVPORT_VLAN                                       */
/*==============================================================*/
create table VPX_DVPORT_VLAN (
   DVS_ID                   BIGINT          not null,
   DVPORTGROUP_ID           BIGINT default 0 not null,
   DVPORT_KEY               VARCHAR(50)         null,
   RUNTIMEINFO_FLG          NUMERIC(1)  default 0  not null,
   VLAN_ID_START            INTEGER          not null,
   VLAN_ID_END              INTEGER          null,
   SURR_KEY					SERIAL,
   constraint PK_VPX_DVPORT_VLAN primary key (DVS_ID,SURR_KEY),
   constraint FK_VPX_DVS_VLAN_REF_VPX_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

CREATE INDEX VPX_DVPORT_VLAN_M1 ON VPX_DVPORT_VLAN(DVS_ID,DVPORTGROUP_ID,DVPORT_KEY);

/*==============================================================*/
/* Table: VPX_UPLINK_TEAMING                                    */
/*==============================================================*/
create table VPX_UPLINK_TEAMING (
   DVS_ID                      BIGINT               not null,
   DVPORTGROUP_ID              BIGINT     default 0 not null,
   DVPORT_KEY                  VARCHAR(50)             null,
   ACTIVE_UPLINK               NUMERIC(1)  default 0  not null,
   UPLINK_NAME                 VARCHAR(255)         not null,
   UPLINK_INDEX                INTEGER                  null,
   SURR_KEY					   SERIAL,
   constraint PK_VPX_UPLINK_TEAMING primary key (DVS_ID,SURR_KEY),
   constraint FK_VPX_TEAMING_REF_VPX_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

CREATE INDEX VPX_UPLINK_TEAMING_M1 ON VPX_UPLINK_TEAMING(DVS_ID, DVPORTGROUP_ID, DVPORT_KEY);

/*==============================================================*/
/* Table: VPX_DVS_BLOB                                          */
/*==============================================================*/
create table VPX_DVS_BLOB (
   DVS_ID                   BIGINT              not null,
   DVPORTGROUP_ID           BIGINT    default 0 not null,
   DVPORT_KEY               VARCHAR(50)            null,
   HOST_ID                  BIGINT    default 0 not null,
   PROPERTY_PATH            VARCHAR(255)         null,
   BLOB_KEY                 VARCHAR(255)        null,
   BLOB_DATA                TEXT                 null,
   SURR_KEY					SERIAL,
   constraint PK_VPX_DVS_BLOB primary key (DVS_ID,SURR_KEY),
   constraint FK_VPX_DVS_BLOB_REF_VPX_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

CREATE INDEX VPX_DVS_BLOB_M1 ON VPX_DVS_BLOB(DVS_ID, DVPORTGROUP_ID, DVPORT_KEY, HOST_ID,PROPERTY_PATH);
CREATE INDEX VPX_DVS_BLOB_F1 ON VPX_DVS_BLOB(HOST_ID);

/*==============================================================*/
/* Table: VPX_DVS_OVERLAY_INSTANCE                              */
/*==============================================================*/
create table VPX_DVS_OVERLAY_INSTANCE (
   DVS_ID                   BIGINT                  not null,
   INSTANCE_KEY	            VARCHAR(255)         not null,
   INSTANCE_DEPTH           int                  not null,
   OVERLAY_CLASS            VARCHAR(255)        not null,
   SURR_KEY					SERIAL,
   constraint PK_VPX_DVS_OVERLAY_INSTANCE primary key (DVS_ID,SURR_KEY),
   constraint FK_DVS_OVERLAY_INSTANCE_REF foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DVS_OPAQUE_DATA                                   */
/*==============================================================*/
create table VPX_DVS_OPAQUE_DATA (
   DVS_ID                   BIGINT              not null,
   DVPORTGROUP_ID           BIGINT    default 0 not null,
   DVPORT_KEY               VARCHAR(50)          not null,
   HOST_ID                  BIGINT    default 0 not null,
   IS_RUNTIME               NUMERIC(1)  default 0  not null,
   IS_INHERITED_TYPE        NUMERIC(1)  default 0  not null,
   OPAQUE_KEY               VARCHAR(255)         not null,
   OPAQUE_DATA              BYTEA                     null,
   SURR_KEY					SERIAL,
   constraint PK_VPX_DVS_OPAQUE_DATA primary key (DVS_ID,SURR_KEY),
   constraint FK_DVS_OPAQUE_REF_VPX_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DVS_RULESET                 */
/*==============================================================*/
create table VPX_DVS_RULESET (
   RULESET_KEY               VARCHAR(100)               not null,
   ENABLED                   NUMERIC(1)                 ,
   PRECEDENCE                INTEGER                    ,
   constraint PK_VPX_DVS_RULESET    primary key  (RULESET_KEY)
)
;

/*==============================================================*/
/* Table: VPX_DVS_RULE                                          */
/*==============================================================*/
create table VPX_DVS_RULE (
   RULESET_KEY               VARCHAR(100)               not null,
   RULE_KEY                  VARCHAR(100)               not null,
   DESCRIPTION               VARCHAR(255)               ,
   SEQUENCE                  INTEGER                    ,
   RULE_DIRECTION            VARCHAR(50)                ,
   QOS_TAG                   INTEGER                    ,
   DSCP_TAG                  INTEGER                    ,
   PACKETS_PER_SECOND        INTEGER                    ,
   ENCAP_IP                  VARCHAR(255)               ,
   REWRITE_MAC               VARCHAR(255)               ,
   DIVERT_OPTION             VARCHAR(50)                ,
   SERVICE_ID                VARCHAR(50)                ,
   JUMP_RULESET_KEY          VARCHAR(100)                ,
   FORWARD_PORT_KEY          VARCHAR(50)                ,
   ACTION_TYPE               INTEGER                    ,
   constraint PK_VPX_DVS_RULE    primary key  (RULE_KEY),
   constraint FK_DVS_RULE_REF_VPX_ENT1 foreign key (RULESET_KEY)
      references VPX_DVS_RULESET (RULESET_KEY)
         on delete cascade
)
;

CREATE INDEX IDX_VPX_DVS_RULE ON VPX_DVS_RULE(RULESET_KEY);

/*==============================================================*/
/* Table: VPX_DVS_RULE_QUALIFIER                                */
/*==============================================================*/
create table VPX_DVS_RULE_QUALIFIER (
   RULE_KEY                  VARCHAR(100)               not null,
   QUALIFIER_KEY             VARCHAR(100)               not null,
   SRC_IP_ADDRESS            VARCHAR(255)               ,
   SRC_IP_NOT_FLG            NUMERIC(1)                 ,
   SRC_IP_PREFIX_LENGTH      INTEGER                    ,
   SRC_IP_CONTAINER_ID       VARCHAR(50)                ,
   SRC_IP_TYPE               INTEGER                    ,
   DST_IP_ADDRESS            VARCHAR(255)               ,
   DST_IP_NOT_FLG            NUMERIC(1)                 ,
   DST_IP_PREFIX_LENGTH      INTEGER                    ,
   DST_IP_CONTAINER_ID       VARCHAR(50)                ,
   DST_IP_TYPE               INTEGER                    ,
   L3_L4_PROTOCOL            INTEGER                    ,
   L3_L4_PROTOCOL_NOT_FLG    NUMERIC(1)                 ,
   SRC_PORT_NUM_START        INTEGER                    ,
   SRC_PORT_NUM_END          INTEGER                    ,
   SRC_PORT_CONTAINER_ID     VARCHAR(50)                ,
   SRC_PORT_TYPE             INTEGER                    ,
   SRC_PORT_NOT_FLG          NUMERIC(1)                 ,
   DST_PORT_NUM_START        INTEGER                    ,
   DST_PORT_NUM_END          INTEGER                    ,
   DST_PORT_CONTAINER_ID     VARCHAR(50)                ,
   DST_PORT_TYPE             INTEGER                    ,
   DST_PORT_NOT_FLG          NUMERIC(1)                 ,
   TCP_FLAGS                 INTEGER                    ,
   TCP_FLAGS_NOT_FLG         NUMERIC(1)                 ,
   SRC_MAC_ADDRESS           VARCHAR(255)               ,
   SRC_MAC_MASK              VARCHAR(255)               ,
   SRC_MAC_CONTAINER_ID      VARCHAR(50)                ,
   SRC_MAC_TYPE              INTEGER                    ,
   SRC_MAC_NOT_FLG           NUMERIC(1)                 ,
   DST_MAC_ADDRESS           VARCHAR(255)               ,
   DST_MAC_MASK              VARCHAR(255)               ,
   DST_MAC_CONTAINER_ID      VARCHAR(50)                ,
   DST_MAC_TYPE              INTEGER                    ,
   DST_MAC_NOT_FLG           NUMERIC(1)                 ,
   L2_PROTOCOL               INTEGER                    ,
   L2_PROTOCOL_NOT_FLG       NUMERIC(1)                 ,
   VLAN_ID                   INTEGER                    ,
   VLAN_ID_NOT_FLG           NUMERIC(1)                 ,
   TYPE_OF_SYSTEM_TRAFFIC    VARCHAR(50)                ,
   SYSTEM_TRAFFIC_NOT_FLG    NUMERIC(1)                 ,
   QUALIFIER_TYPE            INTEGER                    ,
   constraint PK_VPX_DVS_RULE_QUALIFIER    primary key  (QUALIFIER_KEY),
   constraint FK_DVS_QUALIFIER_REF_VPX_ENT1 foreign key (RULE_KEY)
      references VPX_DVS_RULE (RULE_KEY)
         on delete cascade
)
;

CREATE INDEX IDX_VPX_DVS_RULE_QUALIFIER ON VPX_DVS_RULE_QUALIFIER(RULE_KEY);

/*==============================================================*/
/* Table: VPX_DVS_TRAFFIC_FILTER_CONFIG                 */
/*==============================================================*/
create table VPX_DVS_TRAFFIC_FILTER_CONFIG (
   DVS_ID                    BIGINT                   not null,
   DVPORTGROUP_ID            BIGINT         default 0 not null,
   DVPORT_KEY                VARCHAR(50)               not null,
   CONFIG_KEY                VARCHAR(100)               not null,
   AGENT_NAME                VARCHAR(255)               ,
   ON_FAILURE                VARCHAR(50)                ,
   RULESET_KEY               VARCHAR(100)               ,
   CONFIG_TYPE               INTEGER                    ,
   SURR_KEY                  SERIAL,
   constraint PK_VPX_DVS_TRAFFIC_FILT_CONFIG primary key (DVS_ID,SURR_KEY),
   constraint FK_FILTER_CONFIG_REF_VPX_ENT1 foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DVS_TRAFFIC_FILTER_PARAM                  */
/*==============================================================*/
create table VPX_DVS_TRAFFIC_FILTER_PARAM (
   DVS_ID                    BIGINT                   not null,
   DVPORTGROUP_ID            BIGINT         default 0 not null,
   DVPORT_KEY                VARCHAR(50)               not null,
   CONFIG_KEY                VARCHAR(100)               not null,
   PARAM                     VARCHAR(255)               ,
   SURR_KEY                  SERIAL,
   constraint PK_VPX_DVS_TRAFFIC_FILT_PARAM primary key (DVS_ID,SURR_KEY),
   constraint FK_FILTER_PARAM_REF_VPX_ENT1 foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DVS_INFRA_RES_POOL                                */
/*==============================================================*/
create table VPX_DVS_INFRA_RES_POOL (
   DVS_ID                    BIGINT                   not null,
   NRP_KEY                   VARCHAR(50)               not null,
   DESCRIPTION               VARCHAR(255)                      ,
   ALLOCATION_LIMIT          NUMERIC(22)                       ,
   ALLOCATION_SHARES_SHARES  INTEGER                           ,
   ALLOCATION_SHARES_LEVEL   VARCHAR(255)                      ,
   ALLOCATION_RESERVATION    NUMERIC(22)                       ,
   SURR_KEY                  SERIAL,
   constraint PK_VPX_DVS_INFRA_RES_POOL primary key (DVS_ID,SURR_KEY),
   constraint FK_DVS_IRP_REF_VPX_ENT1 foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DVS_VMVNIC_RES_POOL                               */
/*==============================================================*/
create table VPX_DVS_VMVNIC_RES_POOL (
   DVS_ID                    BIGINT                   not null,
   NRP_KEY                   VARCHAR(50)               not null,
   DESCRIPTION               VARCHAR(255)                      ,
   NAME                      VARCHAR(255)                      ,
   CONFIG_VERSION            NUMERIC(22)                       ,
   ALLOCATION_RESERVATION    NUMERIC(22)                       ,
   SURR_KEY                  SERIAL,
   constraint PK_VPX_DVS_VMVNIC_RES_POOL primary key (DVS_ID,SURR_KEY),
   constraint FK_DVS_VMVNICRP_REF_VPX_ENT1 foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_REMOTE_CNX                                        */
/*==============================================================*/
create table VPX_REMOTE_CNX (
   ID                   INTEGER                  not null,
   CNX_TYPE             INTEGER                  not null,
   HOST_NAME            VARCHAR(255)             not null,
   PORT                 INTEGER                  not null,
   SSL                  INTEGER                  not null,
   USER_NAME            VARCHAR(255)             not null,
   PASSWORD             VARCHAR(686)             not null,
   SAMLTOKEN            TEXT                     not null,
   SSL_THUMBPRINT       VARCHAR(255)             not null,
   CONNECT_STATE        INTEGER                  not null,
   STATE_DATA           TEXT                     null,
   SESSION_ID           VARCHAR(80)              null,
   API_VERSION          VARCHAR(80)              null,
   WFU_VERSION          VARCHAR(32)              null,
   constraint PK_VPX_HOST_CNX primary key (ID)
)
;

/*==============================================================*/
/* Table: VPX_REMOTE_CNX_LISTENER                                 */
/*==============================================================*/
create table VPX_REMOTE_CNX_LISTENER (
   HOST_CNX_ID          INTEGER                  not null,
   TYPE_NAME            VARCHAR(255)             not null,
   FILTER_REF           VARCHAR(255)             not null,
   STATE_DATA           TEXT                     null,
   constraint PK_VPX_HOST_CNX_FILTER primary key (HOST_CNX_ID, TYPE_NAME),
   constraint FK_VPX_HOST_CNX_LISTEN_REF foreign key (HOST_CNX_ID)
      references VPX_REMOTE_CNX (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DVS_LAG                                           */
/*==============================================================*/
create table VPX_DVS_LAG (
   DVS_ID                   BIGINT          not null,
   LAG_KEY                  VARCHAR(50)      not null,
   NAME                     VARCHAR(255)     not null,
   LAG_MODE                 VARCHAR(255)     null,
   UPLINK_NUM               INTEGER          null,
   LOADBALANCE_ALGORITHM    VARCHAR(255)     null,
   IPFIX_ENABLED            NUMERIC(1)       null,
   SURR_KEY                 SERIAL,
   constraint PK_VPX_DVS_LAG primary key (DVS_ID, SURR_KEY),
   constraint FK_DVS_LAG_REF_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

CREATE UNIQUE INDEX VPX_DVS_LAG_U1 ON VPX_DVS_LAG(DVS_ID,LAG_KEY);

/*==============================================================*/
/* Table: VPX_DVS_LAG_VLAN                                      */
/*==============================================================*/
create table VPX_DVS_LAG_VLAN (
   DVS_ID                   BIGINT              not null,
   LAG_KEY                  VARCHAR(50)          not null,
   VLAN_ID_START            INTEGER              not null,
   VLAN_ID_END              INTEGER              not null,
   SURR_KEY                 SERIAL,
   constraint PK_VPX_DVS_LAG_VLAN primary key (DVS_ID, SURR_KEY),
   constraint FK_DVS_LAG_VLAN_REF_ENTI foreign key (DVS_ID)
      references VPX_DVS (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_HOST                                              */
/*==============================================================*/
create table VPX_HOST  (
   ID                   BIGINT                         not null,
   DATACENTER_ID        BIGINT                         not null,
   DNS_NAME             VARCHAR(255)                   not null,
   IP_ADDRESS           VARCHAR(255),
   EXPECTED_SSL_THUMBPRINT       VARCHAR(255),
   HOST_SSL_THUMBPRINT       VARCHAR(255),
   USER_NAME            VARCHAR(255),
   PASSWORD             VARCHAR(686),
   PASSWORD_LAST_UPD_DT TIMESTAMP,
   IPMI_IP_ADDRESS      VARCHAR(50),
   IPMI_MAC_ADDRESS     VARCHAR(18),
   IPMI_USER_NAME       VARCHAR(17),
   IPMI_PASSWORD        VARCHAR(686),
   SOAP_PORT            INTEGER                         not null,
   AUTHD_PORT           INTEGER                         not null,
   VPXA_ID              VARCHAR(21)                    not null,
   MASTER_GEN           VARCHAR(21)                    not null,
   MASTER_SPEC_GEN      VARCHAR(21)                    not null,
   UUID_BIOS            VARCHAR(255),
   ENABLED              INTEGER                         not null,
   VMOTION_ENABLED      INTEGER                         not null,
   LICENSED_EDITION     VARCHAR(255)                   null,
   PRODUCT_NAME         VARCHAR(255),
   PRODUCT_FULLNAME     VARCHAR(255),
   PRODUCT_VENDOR       VARCHAR(255),
   PRODUCT_VERSION      VARCHAR(255),
   PRODUCT_BUILD        VARCHAR(255),
   PRODUCT_OS_TYPE      VARCHAR(255),
   PRODUCT_LINE_ID      VARCHAR(255),
   PRODUCT_API_TYPE     VARCHAR(255),
   PRODUCT_API_VERSION  VARCHAR(255),
   CAPABILITY           TEXT,
   HOST_VENDOR          VARCHAR(255),
   HOST_MODEL           VARCHAR(255),
   CPU_MODEL            VARCHAR(255),
   CPU_COUNT            INTEGER,
   CPU_CORE_COUNT       INTEGER,
   CPU_THREAD_COUNT     INTEGER,
   NUMA_TYPE            VARCHAR(255),
   CPU_HZ               VARCHAR(21),
   MEM_SIZE             VARCHAR(21),
   SMC_PRESENT          NUMERIC(1) default 0 not null,
   CPU_POWER_MGMT_POLICY  VARCHAR(255),
   CPU_POWER_MGMT_SUPPORT  VARCHAR(255),
   NIC_COUNT            INTEGER,
   HBA_COUNT            INTEGER,
   CONFIG               TEXT,
   VM_HARDWARE_INFO     TEXT,
   VM_PROV_POLICY       TEXT,
   ROOT_RES_CONFIG      TEXT,
   LAST_PERF_TIME       TIMESTAMP,
   PERF_REFRESH_RATE    INTEGER,
   BOOT_TIME            TIMESTAMP,
   BOOT_TIME_ON_HOST    NUMERIC(21),
   DAS_NODE_NAME        VARCHAR(255),
   MAINTENANCE_MODE     INTEGER,
   POWER_STATE          INTEGER,
   RESOURCE_INFO        TEXT,
   CONFIG_MANAGER       TEXT,
   LOCAL_IP_ADDRESS     VARCHAR(50),
   HOST_KEY             VARCHAR(255),
   ADMIN_DISABLED_FLG   NUMERIC(1)        default 0              not null,
   MANAGEMENT_IP        VARCHAR(50),
   FAULTTOLERANCE_ENABLED_FLG NUMERIC(1) default 0 not null,
   AGENT_VM_DATASTORE_ID   BIGINT,
   AGENT_VM_NETWORK_ID     BIGINT,
   LICENSABLE_RESOURCES  TEXT,
   ENDORSEMENT_KEY          TEXT,
   ATTESTATION_IDENTITY_KEY TEXT,
   CNX_ID               INTEGER                  null,
   NETWORK_RUNTIME_INFO          TEXT,
   GATEWAY_TYPE         VARCHAR(64)             null,
   GATEWAY_ID           VARCHAR(128)            null,
   GATEWAY_TRUST_TOKEN  VARCHAR(255)            null,
   PMEM_CAPACITY_IN_MB  BIGINT                  null,
   CRYPTO_STATE         INTEGER                 null,
   CRYPTO_KEY_ID        VARCHAR(255)            null,
   CRYPTO_KEY_PROVIDER_ID  VARCHAR(255)         null,
   CRYPTO_ENABLE        NUMERIC(1)              null,
   constraint PK_VPX_HOST primary key (ID),
   constraint FK_VPX_HOST_REF_VPX_ENTI foreign key (ID)
         references VPX_ENTITY (ID)
         on delete cascade,
   constraint FK_VPX_HOST_REF_VPX_H_CX foreign key (CNX_ID)
      references VPX_REMOTE_CNX (ID)
);

COMMENT ON COLUMN VPX_HOST.GATEWAY_TYPE IS 'See vim.host.GatewaySpec#gatewayType and vim.host.Summary.GatewaySummary#gatewayType'
;
COMMENT ON COLUMN VPX_HOST.GATEWAY_ID IS 'See vim.host.GatewaySpec#gatewayId and vim.host.Summary.GatewaySummary#gatewayId'
;
COMMENT ON COLUMN VPX_HOST.GATEWAY_TRUST_TOKEN IS 'See vim.host.GatewaySpec#trustVerificationToken'
;

/*
 * Aggressive autovacuum for VPX_HOST to reduce fragmentation caused by huge
 * amount of updates.
 */
ALTER TABLE VPX_HOST SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_HOST SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_HOST SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_HOST SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_HOST SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_HOST SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_HOST SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_HOST SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_HOST SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_HOST SET (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Index: VPXI_HOST_DATACENTER_ID                               */
/*==============================================================*/
create index VPXI_HOST_DATACENTER_ID on VPX_HOST (
   DATACENTER_ID
);

/*==============================================================*/
/* Index: VPXI_HOST_UUID_BIOS                                   */
/*==============================================================*/
create index VPXI_HOST_UUID_BIOS on VPX_HOST (
   UUID_BIOS
);

/*==============================================================*/
/* Index: VPXI_HOST_DNS_NAME                                    */
/*==============================================================*/
create index VPXI_HOST_DNS_NAME on VPX_HOST (
   DNS_NAME
);

/*==============================================================*/
/* Index: VPXI_HOST_IP_ADDRESS                                  */
/*==============================================================*/
create index VPXI_HOST_IP_ADDRESS on VPX_HOST (
   IP_ADDRESS
);

CREATE INDEX IDX_VPX_HOST ON VPX_HOST(CNX_ID);

/*==============================================================*/
/* Table: VPX_HOST_SYSTEM_ID_INFO                               */
/*==============================================================*/
create table VPX_HOST_SYSTEM_ID_INFO (
   HOST_ID                      BIGINT                  not null,
   SYSTEM_IDENTIFICATION_INFO   TEXT,
   constraint PK_HOST_SYSIDINFO primary key (HOST_ID),
   constraint FK_HOST_SYSIDINFO_REF_VPX_HOST foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_HOST_X                                            */
/*==============================================================*/
create table VPX_HOST_X (
   HOST_ID              BIGINT                  not null,
   SYSTEM_HEALTH        TEXT                 NULL,
   DAS_NODE_NAME        VARCHAR(255)         NULL,
   DAS_EVENT_VERSION    int                  NULL,
   DAS_EVENT_KEY        int                  NULL,
   DAS_FDM_STATE_SOURCE int                  NULL,
   DAS_VC_STATE         int                  NULL,
   DAS_FDM_STATE        VARCHAR(128)         NULL,
   BIOS_VERSION         VARCHAR(255)         NULL,
   BIOS_RELEASE_DATE    TIMESTAMP            NULL,
   constraint PK_VPX_HOST_X primary key (HOST_ID),
   constraint FK_VPX_HOST_X_REF_VPX_HOST foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
)
;



/*==============================================================*/
/* Table: VPX_HOST_GW_PARAMS                                    */
/*                                                              */
/* Represents a list of opqaue parameters required by a host    */
/* gateway server in order to connect to the host. Will contain */
/* records only for hosts managed via a host gateway.           */
/*==============================================================*/
create table VPX_HOST_GW_PARAMS (
   HOST_ID              BIGINT                 not null,
   PARAM_NAME           VARCHAR(255)            not null,
   VALUE                TEXT                    null,
   constraint PK_VPX_HOST_GW_PARAMS primary key (HOST_ID, PARAM_NAME),
   constraint FK_VPX_HOST_GW_PARAMS_REF foreign key (HOST_ID)
      references VPX_HOST (ID)
         on delete cascade
)
;

COMMENT ON TABLE VPX_HOST_GW_PARAMS IS 'A list of opaque parameters required by host gateway server to connect to a host. See vim.host.GatewaySpec#hostAuthParams'
;
COMMENT ON COLUMN VPX_HOST_GW_PARAMS.HOST_ID IS 'Id of the host to which the parameter pertains.'
;
COMMENT ON COLUMN VPX_HOST_GW_PARAMS.PARAM_NAME IS 'Parameter name. Unique per HOST_ID'
;
COMMENT ON COLUMN VPX_HOST_GW_PARAMS.VALUE IS 'Opaque value of the parameter'
;

/*==============================================================*/
/* Table: VPX_RESOURCE_POOL                                     */
/*==============================================================*/
create table VPX_RESOURCE_POOL  (
   ID                   BIGINT                         not null,
   CONFIG_SPEC          TEXT,
   FOLDER_ID            BIGINT                         null,     /* VOE */
   VAPP_CONFIG          TEXT                            null,     /* VOE */
   MANAGED_BY_EXT_KEY   VARCHAR(255)                    null,     /* vApp */
   MANAGED_BY_TYPE      VARCHAR(255)                    null,     /* vApp */
   constraint PK_VPX_RESOURCE_POOL primary key (ID),
   constraint FK_VPX_RESPOOL_REF_VPX_ENTI foreign key (ID)
         references VPX_ENTITY (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_DS_ASSIGNMENT                                     */
/*==============================================================*/
create table VPX_DS_ASSIGNMENT  (
   DS_ID                BIGINT                         not null,
   ENTITY_ID            BIGINT                          not null,
   ACCESSIBLE           INTEGER,
   MOUNT_PATH           VARCHAR(255),
   MOUNT_ID             VARCHAR(255),
   MOUNT_MODE           VARCHAR(21),
   MOUNTED              INTEGER,
   constraint PK_VPX_DS_ASSIGNMENT primary key (DS_ID, ENTITY_ID),
   constraint FK_VPX_DS_A_REF_VPX_DATA foreign key (DS_ID)
         references VPX_DATASTORE (ID),
   constraint FK_VPX_DS_A_REF_VPX_ENTI foreign key (ENTITY_ID)
         references VPX_ENTITY (ID)
         on delete cascade
);
/*==============================================================*/
/* Index: VPXI_DS_ASSIGNMENT_ENTITY                             */
/*==============================================================*/
create   index VPXI_DS_ASSIGNMENT_ENTITY on VPX_DS_ASSIGNMENT (
   ENTITY_ID
)
;

/*==============================================================*/
/* Table: VPX_HOST_VM_CONFIG_OPTION                             */
/*==============================================================*/
create table VPX_HOST_VM_CONFIG_OPTION  (
   HOST_ID              BIGINT                         not null,
   CONFIG_OPTION_VER    VARCHAR(255)                   not null,
   DATA                 TEXT,
   ARRAY_INDEX          INTEGER                         not null,
   CONFIG_OPTION_DESC   VARCHAR(255),
   CREATE_SUPPORTED_FLG  NUMERIC(1),
   DEFAULT_CONFIG_OPTION_FLG NUMERIC(1),
   RUN_SUPPORTED_FLG         NUMERIC(1) default 1 not null,
   UPGRADE_SUPPORTED_FLG     NUMERIC(1) default 1 not null,
   constraint PK_VPX_HOST_VM_CONFIG_OPTION primary key
   (HOST_ID, CONFIG_OPTION_VER),
   constraint FK_VPX_HOST_VM_CONF_REF_HOST foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_HOST_VM_CONFIG_OPTION SET (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_COMPUTE_RESOURCE_DAS_VM                           */
/*==============================================================*/
create table VPX_COMPUTE_RESOURCE_DAS_VM  (
   COMP_RES_ID          BIGINT                         not null,
   VM_ID                BIGINT                          not null,
   PRIORITY             INTEGER,
   NUM_FAILURE          INTEGER,
   RETRY_PERIOD_SEC     INTEGER,
   POWER_OFF_ON_ISOLATION INTEGER,
   VMHEALTH_VM_MONITORING    INTEGER               NULL,
   VMHEALTH_FAILURE_INTERVAL INTEGER               NULL,
   VMHEALTH_MIN_UPTIME       INTEGER               NULL,
   VMHEALTH_MAX_FAILURES     INTEGER               NULL,
   VMHEALTH_MAX_FAILURE_WINDOW INTEGER             NULL,
   VMCP_APD_TERMINATE       VARCHAR(30),
   VMCP_APD_TERMINATE_DELAY INTEGER,
   VMCP_APD_RESET           VARCHAR(30),
   VMCP_PDL_TERMINATE       VARCHAR(30),
   RESTART_PRIORITY_TIMEOUT_VM INTEGER,
   constraint PK_VPX_COMP_DAS_VM primary key (COMP_RES_ID, VM_ID),
   constraint FK_VPX_COMP_DAS_VM_REF_VPX_COM foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID),
   constraint FK_VPX_COMP_DAS_VM_REF_VPX_VM foreign key (VM_ID)
         references VPX_VM (ID) on delete cascade
);

CREATE INDEX VPX_COMPUTE_RESOURCE_DAS_VM_F1 ON VPX_COMPUTE_RESOURCE_DAS_VM(VM_ID);

/*==============================================================*/
/* Table: VPX_COMPUTE_RESOURCE_ORC_VM                           */
/*==============================================================*/
create table VPX_COMPUTE_RESOURCE_ORC_VM  (
   COMP_RES_ID          BIGINT                         not null,
   VM_ID                BIGINT                          not null,
   ORC_READY_CONDITION_VM   INTEGER,
   ORC_POST_READY_DELAY_VM  INTEGER,
   constraint PK_VPX_COMP_ORC_VM primary key (COMP_RES_ID, VM_ID),
   constraint FK_VPX_COMP_ORC_VM_REF_VPX_COM foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID),
   constraint FK_VPX_COMP_ORC_VM_REF_VPX_VM foreign key (VM_ID)
         references VPX_VM (ID) on delete cascade
);

CREATE INDEX VPX_COMPUTE_RESOURCE_ORC_VM_F1 ON VPX_COMPUTE_RESOURCE_ORC_VM(VM_ID);
CREATE INDEX VPX_COMPUTE_RESOURCE_ORC_VM_F2 ON VPX_COMPUTE_RESOURCE_ORC_VM(COMP_RES_ID);


/*==============================================================*/
/* Table: VPX_DAS_HB_DATASTORE_SYS                              */
/*==============================================================*/
create table VPX_DAS_HB_DATASTORE_SYS  (
   COMP_RES_ID      BIGINT                         not null,
   DATASTORE_ID     BIGINT                         not null,
   HOST_ID          BIGINT                         not null,
   constraint PK_VPX_COMP_DAS_HB_DS_SYS primary key (COMP_RES_ID, DATASTORE_ID, HOST_ID),
   constraint FK_VPX_COMP_DAS_HB_DS_SYS2 foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID),
   constraint FK_VPX_COMP_DAS_HB_DS_SYS1 foreign key (DATASTORE_ID)
         references VPX_DATASTORE (ID),
   constraint FK_VPX_COMP_DAS_HB_DS_SYS3 foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_COMPUTE_RES_USER_HB_DS                         */
/*==============================================================*/
create table VPX_COMPUTE_RES_USER_HB_DS (
   COMP_RES_ID               BIGINT                  not null,
   DS_ID                     BIGINT                  not null,
   constraint PK_COMPUTE_RES_USER_HB_DS primary key  (COMP_RES_ID, DS_ID),
   constraint FK_COMPUTE_RES_USER_HB_DS1 foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID) ,
   constraint FK_COMPUTE_RES_USER_HB_DS2 foreign key (DS_ID)
      references VPX_DATASTORE (ID)  on delete cascade
);

/*==============================================================*/
/* Table: VPX_COMPUTE_RESOURCE_DRS_VM                           */
/*==============================================================*/
create table VPX_COMPUTE_RESOURCE_DRS_VM  (
   COMP_RES_ID          BIGINT                         not null,
   VM_ID                BIGINT                          not null,
   ENABLED               INTEGER,
   BEHAVIOR             INTEGER,
   constraint PK_VPX_COMP_DRS_VM primary key (COMP_RES_ID, VM_ID),
   constraint FK_VPX_COMP_DRS_VM_REF_VPX_COM foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID),
   constraint FK_VPX_COMP_DRS_VM_REF_VPX_VM foreign key (VM_ID)
         references VPX_VM (ID) on delete cascade
);

CREATE INDEX VPX_COMPUTE_RESOURCE_DRS_VM_F1 ON VPX_COMPUTE_RESOURCE_DRS_VM(VM_ID);

/*==============================================================*/
/* Table: VPX_COMPUTE_RESOURCE_DPM_HOST                         */
/*==============================================================*/
create table VPX_COMPUTE_RESOURCE_DPM_HOST (
   COMP_RES_ID               BIGINT                  not null,
   HOST_ID                   BIGINT                  not null,
   DPM_ENABLED_OVERRIDE_FLG  NUMERIC(1)               null,
   HOST_BEHAVIOR_OVERRIDE    NUMERIC(1)               null,
   constraint PK_VPX_COMP_RESOURCE_DPM_HOST primary key  (COMP_RES_ID,HOST_ID),
   constraint FK_VPX_COMPRES_DPM_HOST1 foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID),
   constraint FK_VPX_COMPRES_DPM_HOST2 foreign key (HOST_ID)
      references VPX_HOST (ID)
         on delete cascade
)
;


/*==============================================================*/
/* Table: VPX_HOST_CPU                                          */
/*==============================================================*/
create table VPX_HOST_CPU  (
   HOST_ID              BIGINT                         not null,
   CPU_INDEX            INTEGER                         not null,
   HZ                   VARCHAR(21)                    not null,
   BUS_HZ               VARCHAR(21)                    not null,
   DESCRIPTION          VARCHAR(255)                   ,
   VENDOR               VARCHAR(255)                   not null,
   constraint PK_VPX_HOST_CPU primary key (HOST_ID, CPU_INDEX),
   constraint FK_VPX_HOST_REFERENCE_VPX_HOST foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_HOST_VFLASH                                       */
/*==============================================================*/
create table VPX_HOST_VFLASH (
   HOST_ID               BIGINT              not null,
   CAPACITY              VARCHAR(21)          null,
   USAGE                 VARCHAR(21)          null,
   CAPACITY_VMCACHE      VARCHAR(21)          null,
   FREE_VMCACHE          VARCHAR(21)          null,
   ACCESSIBLE            INTEGER              null,
   constraint PK_VPX_HOST_VFLASH primary key (HOST_ID),
   constraint FK_VPX_HOST_VFLASH foreign key (HOST_ID)
      references VPX_HOST (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_HOST_CPU_THREAD                                   */
/*==============================================================*/
create table VPX_HOST_CPU_THREAD  (
   HOST_ID              BIGINT                         not null,
   CPU_INDEX            INTEGER                         not null,
   THREAD_ID            INTEGER                         not null,
   constraint PK_VPX_CPU_THREAD primary key (HOST_ID, CPU_INDEX, THREAD_ID),
   constraint FK_VPX_CPU_THREAD_REF_HOST_CPU foreign key (HOST_ID, CPU_INDEX)
         references VPX_HOST_CPU (HOST_ID, CPU_INDEX)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_HOST_CPU_CPUID_FEATURE                            */
/*==============================================================*/
create table VPX_HOST_CPU_CPUID_FEATURE  (
   HOST_ID              BIGINT                         not null,
   CPU_INDEX            INTEGER                         not null,
   CPU_FEATURE_LEVEL    INTEGER                         not null,
   CPU_FEATURE_VENDOR   VARCHAR(16),
   CPU_EAX              VARCHAR(40),
   CPU_EBX              VARCHAR(40),
   CPU_ECX              VARCHAR(40),
   CPU_EDX              VARCHAR(40),
   constraint PK_VPX_CPU_CPUID_FEAT primary key (HOST_ID, CPU_INDEX, CPU_FEATURE_LEVEL),
   constraint FK_VPX_CPU_CPUID_F_REF_H_CPU foreign key (HOST_ID, CPU_INDEX)
         references VPX_HOST_CPU (HOST_ID, CPU_INDEX)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_HOST_NODE                                         */
/*==============================================================*/
create table VPX_HOST_NODE  (
   HOST_ID              BIGINT                         not null,
   NUMA_ID              INTEGER                         not null,
   MEM_RANGE_BEGIN      VARCHAR(21)                    not null,
   MEM_RANGE_LENGTH     VARCHAR(21)                    not null,
   constraint PK_VPX_HOST_NODE primary key (HOST_ID, NUMA_ID),
   constraint FK_VPX_HOST_NODE_REF_VPX_HOST foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_GUEST_DISK                                        */
/*==============================================================*/
create table VPX_GUEST_DISK  (
   VM_ID                BIGINT                         not null,
   PATH                 VARCHAR(255)                   not null,
   CAPACITY             VARCHAR(21),
   FREE_SPACE           VARCHAR(21),
   constraint PK_VPX_GUEST_DISK primary key (VM_ID, PATH),
   constraint FK_VPX_VD_REF_VPX_VM foreign key (VM_ID)
         references VPX_VM (ID) on delete cascade
);

/*
 * Aggressive autovacuum for VPX_GUEST_DISK to reduce fragmentation caused by
 * huge amount of updates.
 */
ALTER TABLE VPX_GUEST_DISK SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_GUEST_DISK SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_GUEST_DISK SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_GUEST_DISK SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_GUEST_DISK SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_GUEST_DISK SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_GUEST_DISK SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_GUEST_DISK SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_GUEST_DISK SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_GUEST_DISK SET (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_NIC                                               */
/*==============================================================*/
create table VPX_NIC  (
   ENTITY_ID            BIGINT                          not null,
   DEVICE_ID            INTEGER                         not null,
   MAC_ADDRESS          VARCHAR(20),
   IS_CONNECTED         INTEGER,
   NETWORK_NAME         VARCHAR(255),
   DNS_CONFIG           TEXT,
   IP_CONFIG            TEXT,
   NET_BIOS_CONFIG      TEXT,
   SURR_KEY             SERIAL,
   constraint PK_VPX_NIC primary key  (ENTITY_ID, DEVICE_ID, SURR_KEY),
   constraint FK_VPX_VN_REF_VPX_VM foreign key (ENTITY_ID)
         references VPX_ENTITY (ID)
         on delete cascade
);

/*==============================================================*/
/* Index: VPXI_GUEST_NET_MAC                                    */
/*==============================================================*/
create index VPXI_GUEST_NET_MAC on VPX_NIC (MAC_ADDRESS);

/*
 * Aggressive autovacuum for VPX_NIC to reduce fragmentation caused by huge
 * amount of updates.
 */
ALTER TABLE VPX_NIC SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_NIC SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_NIC SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_NIC SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_NIC SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_NIC SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_NIC SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_NIC SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_NIC SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_NIC SET (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_HOST_NODE_CPU                                     */
/*==============================================================*/
create table VPX_HOST_NODE_CPU  (
   HOST_ID              BIGINT                         not null,
   NUMA_ID              INTEGER                         not null,
   CPU_ID               INTEGER                         not null,
   CONSTRAINT PK_VPX_HOST_NODE_CPU PRIMARY KEY (HOST_ID,NUMA_ID, CPU_ID),
   constraint FK_VPX_NODE_CPU_REF_HOST_NODE foreign key (HOST_ID, NUMA_ID)
         references VPX_HOST_NODE (HOST_ID, NUMA_ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_IP_ADDRESS                                        */
/*==============================================================*/
create table VPX_IP_ADDRESS  (
   ENTITY_ID            BIGINT                          not null,
   DEVICE_ID            INTEGER                         not null,
   IP_ADDRESS           VARCHAR(50)                     not null,
   constraint FK_VPX_GUES_REFERENCE_VPX_GUES foreign key (ENTITY_ID)
         references VPX_ENTITY (ID)
         on delete cascade
);
CREATE INDEX IX_VPX_IP_ADDRESS ON VPX_IP_ADDRESS(ENTITY_ID, DEVICE_ID);

/*
 * Aggressive autovacuum for VPX_IP_ADDRESS to reduce fragmentation caused by
 * huge amount of updates.
 */
ALTER TABLE VPX_IP_ADDRESS SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_IP_ADDRESS SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_IP_ADDRESS SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_IP_ADDRESS SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_IP_ADDRESS SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_IP_ADDRESS SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_IP_ADDRESS SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_IP_ADDRESS SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_IP_ADDRESS SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_IP_ADDRESS SET (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_HOST_PCI_DEVICE                                   */
/*==============================================================*/
create table VPX_HOST_PCI_DEVICE  (
   HOST_ID              BIGINT                         not null,
   PCI_ID               VARCHAR(255)                   not null,
   CLASS_ID             INTEGER                         not null,
   BUS                  INTEGER                         not null,
   SLOT                 INTEGER                         not null,
   PCI_FUNCTION         INTEGER                         not null,
   VENDOR_ID            INTEGER                         not null,
   SUB_VENDOR_ID        INTEGER                         not null,
   VENDOR_NAME          VARCHAR(255)                   not null,
   DEVICE_ID            INTEGER                         not null,
   SUB_DEVICE_ID        INTEGER                         not null,
   DEVICE_NAME          VARCHAR(450)                   not null,
   SURR_KEY             SERIAL,
   CONSTRAINT PK_VPX_HOST_PCI_DEVICE PRIMARY KEY (HOST_ID, SURR_KEY),
   constraint FK_VPX_HOST_PCI_REF_VPX_HOST foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_HOST_CPUID_FEATURE                                  */
/*==============================================================*/
create table VPX_HOST_CPUID_FEATURE  (
   HOST_ID              BIGINT                         not null,
   HOST_FEATURE_LEVEL   INTEGER                         not null,
   HOST_FEATURE_VENDOR  VARCHAR(16),
   HOST_EAX             VARCHAR(40),
   HOST_EBX             VARCHAR(40),
   HOST_ECX             VARCHAR(40),
   HOST_EDX             VARCHAR(40),
   SURR_KEY             SERIAL,
   CONSTRAINT PK_VPX_HOST_CPUID_FEATURE PRIMARY KEY (HOST_ID,SURR_KEY),
   constraint FK_VPX_HOST_CPUID_F_REF_VPX_H foreign key (HOST_ID)
         references VPX_HOST (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_EXT                                               */
/*==============================================================*/
create table VPX_EXT (
   EXT_ID                   VARCHAR(255)      not null,
   VERSION                  VARCHAR(255)      null,
   HEARTBEAT                TIMESTAMP         null,
   SUBJECT_NAME             TEXT              null,
   THUMBPRINT               VARCHAR(100)      null,
   TYPE_NAME                VARCHAR(255)      null,
   HEALTH_URL               VARCHAR(255)      null,
   COMPANY                  VARCHAR(255)      null,
   OVF_CONSUMER_URL         VARCHAR(255)      null,
   OVF_CONSUMER_SECTION_TYPES TEXT            null,
   COMPANY_URL              TEXT              null,
   PRODUCT_URL              TEXT              null,
   MANAGEMENT_URL           TEXT              null,
   SELF_ENTITY_ID           BIGINT           null,
   IN_SOLUTION_MANAGER_FLG  NUMERIC(1) DEFAULT 0 not null,
   SMALL_ICON_URL           TEXT              null,
   DESC_LABEL               VARCHAR(255)      null,
   DESC_SUMMARY             VARCHAR(255)      null,
   constraint PK_VPX_EXT primary key  (EXT_ID)
);

/*==============================================================*/
/* Table: VPX_EXT_SERVER                                        */
/*==============================================================*/
create table VPX_EXT_SERVER (
   EXT_SERVER_ID        INTEGER           not null,
   EXT_ID               VARCHAR(255)     not null,
   URL                  VARCHAR(255)     null,
   COMPANY              VARCHAR(255)     null,
   TYPE                 VARCHAR(255)     null,
   SERVER_THUMBPRINT 	VARCHAR(100)	   null,
   DESC_LABEL           VARCHAR(255)       null,
   DESC_SUMMARY         VARCHAR(255)       null,
   constraint PK_VPX_EXT_SERVER primary key  (EXT_SERVER_ID),
   constraint FK_VPX_EXT_SERVER_REF_EXT foreign key (EXT_ID)
      references VPX_EXT (EXT_ID)
      on delete cascade
);

/*==============================================================*/
/* Table: VPX_EXT_SERVER_EMAIL                                  */
/*==============================================================*/
create table VPX_EXT_SERVER_EMAIL (
   EXT_EMAIL_ID         INTEGER              not null,
   EXT_SERVER_ID        INTEGER              not null,
   EMAIL_ADDRESS        VARCHAR(255)        null,
   constraint PK_VPX_EXT_SERVER_EMAIL primary key  (EXT_EMAIL_ID),
   constraint FK_VPX_EMAIL_REF_SERVER foreign key (EXT_SERVER_ID)
      references VPX_EXT_SERVER (EXT_SERVER_ID)
      on delete cascade
);

/*==============================================================*/
/* Table: VPX_EXT_CLIENT                                        */
/*==============================================================*/
create table VPX_EXT_CLIENT (
   EXT_CLIENT_ID        INTEGER               not null,
   EXT_ID               VARCHAR(255)         not null,
   URL                  VARCHAR(255)         null,
   VERSION              VARCHAR(255)         null,
   COMPANY              VARCHAR(255)         null,
   TYPE                 VARCHAR(255)         null,
   DESC_LABEL           VARCHAR(255)         null,
   DESC_SUMMARY         VARCHAR(255)         null,
   constraint PK_VPX_EXT_CLIENT primary key  (EXT_CLIENT_ID),
   constraint FK_VPX_EXT_CLIENT_REF_EXT foreign key (EXT_ID)
      references VPX_EXT (EXT_ID)
      on delete cascade
);

/*==============================================================*/
/* Table: VPX_EXT_TYPE_IDS                                      */
/*==============================================================*/
create table VPX_EXT_TYPE_IDS (
   EXT_ID               VARCHAR(255)         not null,
   TYPE                 VARCHAR(255)         not null,
   ID                   VARCHAR(255)         not null,
   TYPE_SCHEMA          TEXT                  null,
   SURR_KEY             SERIAL,
   constraint PK_VPX_EXT_TYPE_IDS primary key (EXT_ID,SURR_KEY),
   constraint FK_VETI_REF_EXT foreign key (EXT_ID)
      references VPX_EXT (EXT_ID)
      on delete cascade
);


/*==============================================================*/
/* Table: VPX_EXT_PRIVS                                         */
/*==============================================================*/
create table VPX_EXT_PRIVS (
   PRIV_ID              VARCHAR(255)         not null,
   EXT_ID               VARCHAR(255)         not null,
   GROUP_NAME           VARCHAR(255)         not null,
   SURR_KEY             SERIAL,
   constraint PK_VPX_EXT_PRIVS primary key (EXT_ID,SURR_KEY),
   constraint FK_VPX_EXT_PRIVS_REF_EXT foreign key (EXT_ID)
      references VPX_EXT (EXT_ID)
      on delete cascade
);

/*==============================================================*/
/* Table: VPX_EXT_MANAGEDBY_INFO                                */
/*==============================================================*/
create table VPX_EXT_MANAGEDBY_INFO (
   EXT_ID               VARCHAR(255)         not null,
   TYPE                 VARCHAR(190)         not null,
   SMALL_ICON_URL       TEXT                 not null,
   DESCRIPTION          TEXT                 not null,
   ICON_URL             TEXT      DEFAULT '' not null,
   constraint PK_VPX_EXT_MANAGEDBY_INFO primary key (EXT_ID, TYPE),
   constraint FK_VPX_EXT_MGDBY_INF_REF_EXT foreign key (EXT_ID)
      references VPX_EXT (EXT_ID)
      on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_EXT_TABS                                          */
/*==============================================================*/
create table VPX_EXT_TABS (
   EXT_ID               VARCHAR(255)         not null,
   TAB_INDEX            INTEGER              not null,
   LABEL                VARCHAR(255)         not null,
   URL                  TEXT                 not null,
   SURR_KEY             SERIAL,
   constraint PK_VPX_EXT_TABS primary key (EXT_ID,SURR_KEY),
   constraint FK_VPX_EXT_TABS_REF_EXT foreign key (EXT_ID)
      references VPX_EXT (EXT_ID)
      on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_EXT_DATA                                          */
/*==============================================================*/
create table VPX_EXT_DATA (
   EXT_ID               VARCHAR(255)         not null,
   DATA_KEY             VARCHAR(255)         not null,
   DATA_VALUE           TEXT                 null,
   SURR_KEY             SERIAL,
   constraint PK_VPX_EXT_DATA primary key (EXT_ID,SURR_KEY)
);

/*==============================================================*/
/* Table: VPX_DUAL                                              */
/*==============================================================*/
CREATE TABLE VPX_DUAL
(
DUMMY char(1)
);

/*==============================================================*/
/* Table: VPX_HOST_DISABLEADMIN                                 */
/*==============================================================*/
create table VPX_HOST_DISABLEADMIN (
   HOST_ID              NUMERIC(38)            not null,
   ENTITY_TYPE          VARCHAR(256)         not null,
   ENTITY_MOID          VARCHAR(256)         not null,
   PRINCIPAL_NAME       VARCHAR(180)         not null,
   GROUP_FLG            NUMERIC(1)   DEFAULT 0 not null,
   PROPAGATE_FLG        NUMERIC(1)   DEFAULT 0 not null,
   ROLE_ID_VAL          NUMERIC(10)  DEFAULT 0 not null,
   CONSTRAINT PK_VPX_HOST_DISABLEADMIN PRIMARY KEY
    (HOST_ID, ENTITY_MOID, PRINCIPAL_NAME, GROUP_FLG, PROPAGATE_FLG)
);

/*==============================================================*/
/* Table: VPX_COMPUTE_RESOURCE_VSAN_HOST                        */
/*==============================================================*/
create table VPX_COMPUTE_RESOURCE_VSAN_HOST  (
   COMP_RES_ID          BIGINT                         not null,
   HOST_ID              BIGINT                         not null,
   NODE_UUID            VARCHAR(36),
   CLUSTER_UUID         VARCHAR(36),
   AUTOCLAIM_STORAGE    INTEGER,
   ENABLED              INTEGER,
   FAULT_DOMAIN         VARCHAR(256),
   CHECKSUM_ENABLED     NUMERIC(1),
   constraint PK_COMP_RESOURCE_VSAN_HOST
       primary key (COMP_RES_ID, HOST_ID),
   constraint FK_COMP_RES_VSAN_REF_COMP_RES
       foreign key (COMP_RES_ID) references VPX_COMPUTE_RESOURCE (ID),
   constraint FK_COMP_RES_VSAN_REF_HOST
       foreign key (HOST_ID) references VPX_HOST (ID)
       on delete cascade
);

/*==============================================================*/
/* Table: VPX_DISABLED_METHODS                                  */
/*==============================================================*/
CREATE TABLE VPX_DISABLED_METHODS
(
        ENTITY_MO_ID_VAL        VARCHAR(255) NOT NULL,
        METHOD_NAME             VARCHAR(50)  NOT NULL,
        SOURCE_ID_VAL           VARCHAR(50)  NOT NULL,
        REASON_ID_VAL           VARCHAR(255),
        CONSTRAINT PK_VPX_DISABLED_METHODS PRIMARY KEY
            (ENTITY_MO_ID_VAL,  METHOD_NAME, SOURCE_ID_VAL)
);

/*==============================================================*/
/* Table: VPX_STAT_INTERVAL_DEF                                 */
/*==============================================================*/
create table VPX_STAT_INTERVAL_DEF (
 INTERVAL_SEQ_NUM   NUMERIC(2) NOT NULL,
 INTERVAL_DEF_NAME  VARCHAR(30),
 INTERVAL_VAL       NUMERIC(10),
 INTERVAL_LENGTH    NUMERIC(10),
 STATS_LEVEL        NUMERIC(10),
 ROLLUP_ENABLED_FLG        NUMERIC(1) DEFAULT 1 NOT NULL,
 CONSTRAINT PK_VPX_STAT_INTERVAL_DEF PRIMARY KEY (INTERVAL_SEQ_NUM)
)
;

/*==============================================================*/
/* Table: VPX_DEVICE                                            */
/*==============================================================*/
create table VPX_DEVICE (
 DEVICE_ID        NUMERIC(38) NOT NULL,
 DEVICE_NAME      VARCHAR(450),
 constraint PK_VPX_DEVICE primary key (DEVICE_ID)
);

/*==============================================================*/
/* Index: VPX_DEVICE_U1                                         */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_DEVICE_U1 on VPX_DEVICE(DEVICE_NAME);

/*==============================================================*/
/* Table: VPX_STAT_COUNTER                                      */
/*==============================================================*/
create table VPX_STAT_COUNTER (
  COUNTER_ID  NUMERIC(38) NOT NULL,
  ENTITY_ID   NUMERIC(38) NOT NULL,
  STAT_ID     NUMERIC(38) NOT NULL,
  DEVICE_ID   NUMERIC(38) NOT NULL,
  STAT_LEVEL  NUMERIC(2),
  CONSTRAINT PK_VPX_STAT_COUNTER PRIMARY KEY (ENTITY_ID,STAT_ID,DEVICE_ID)
);

/*==============================================================*/
/* Index: VPX_STAT_COUNTER_P1                                   */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_STAT_COUNTER_P1 ON VPX_STAT_COUNTER(COUNTER_ID);

/*==============================================================*/
/* Index: VPX_STAT_COUNTER_M1                                   */
/*==============================================================*/
CREATE INDEX VPX_STAT_COUNTER_M1 ON VPX_STAT_COUNTER(STAT_ID,COUNTER_ID);

/*==============================================================*/
/* Table: VPX_SAMPLE_TIME1                                     */
/*==============================================================*/
create table VPX_SAMPLE_TIME1 (
 TIME_ID          NUMERIC(38) NOT NULL,
 SAMPLE_TIME      TIMESTAMP,
 SAMPLE_INTERVAL  NUMERIC(10),
 PARTITION_INDEX  NUMERIC(3) NOT NULL,
 ROLLUP_COUNTER   NUMERIC(38),
 PARTITION_INDEX_HS2  NUMERIC(3),
 CONSTRAINT PK_VPX_SAMPLE_TIME1 PRIMARY KEY (TIME_ID)
);

/*==============================================================*/
/* Index: VPX_SAMPLE_TIME1_U1                                   */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_SAMPLE_TIME1_U1 ON VPX_SAMPLE_TIME1(SAMPLE_TIME, SAMPLE_INTERVAL);

/*==============================================================*/
/* Index: VPX_SAMPLE_TIME1_M1                                   */
/*==============================================================*/
CREATE INDEX VPX_SAMPLE_TIME1_M1 ON VPX_SAMPLE_TIME1(ROLLUP_COUNTER);

/*==============================================================*/
/* Table: VPX_SAMPLE_TIME2                                      */
/*==============================================================*/
create table VPX_SAMPLE_TIME2 (
 TIME_ID          NUMERIC(38) NOT NULL,
 SAMPLE_TIME      TIMESTAMP,
 SAMPLE_INTERVAL  NUMERIC(10),
 PARTITION_INDEX  NUMERIC(3) NOT NULL,
 ROLLUP_COUNTER   NUMERIC(38),
 PARTITION_INDEX_HS3  NUMERIC(3),
 CONSTRAINT PK_VPX_SAMPLE_TIME2 PRIMARY KEY (TIME_ID)
);


/*==============================================================*/
/* Index: VPX_SAMPLE_TIME2_U1                                   */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_SAMPLE_TIME2_U1 ON VPX_SAMPLE_TIME2(SAMPLE_TIME, SAMPLE_INTERVAL);

/*==============================================================*/
/* Index: VPX_SAMPLE_TIME2_M1                                   */
/*==============================================================*/
CREATE INDEX VPX_SAMPLE_TIME2_M1 ON VPX_SAMPLE_TIME2(ROLLUP_COUNTER);

/*==============================================================*/
/* Table: VPX_SAMPLE_TIME3                                     */
/*==============================================================*/
create table VPX_SAMPLE_TIME3 (
 TIME_ID          NUMERIC(38) NOT NULL,
 SAMPLE_TIME      TIMESTAMP,
 SAMPLE_INTERVAL  NUMERIC(10),
 PARTITION_INDEX  NUMERIC(3) NOT NULL,
 ROLLUP_COUNTER   NUMERIC(38),
 PARTITION_INDEX_HS4  NUMERIC(3),
 CONSTRAINT PK_VPX_SAMPLE_TIME3 PRIMARY KEY (TIME_ID)
);


/*==============================================================*/
/* Index: VPX_SAMPLE_TIME3_U1                                   */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_SAMPLE_TIME3_U1 ON VPX_SAMPLE_TIME3(SAMPLE_TIME, SAMPLE_INTERVAL);

/*==============================================================*/
/* Index: VPX_SAMPLE_TIME3_M1                                   */
/*==============================================================*/
CREATE INDEX VPX_SAMPLE_TIME3_M1 ON VPX_SAMPLE_TIME3(ROLLUP_COUNTER);

/*==============================================================*/
/* Table: VPX_SAMPLE_TIME4                                      */
/*==============================================================*/
create table VPX_SAMPLE_TIME4 (
 TIME_ID          NUMERIC(38) NOT NULL,
 SAMPLE_TIME      TIMESTAMP,
 SAMPLE_INTERVAL  NUMERIC(10),
 PARTITION_INDEX  NUMERIC(3) NOT NULL,
 ROLLUP_COUNTER   NUMERIC(38),
 CONSTRAINT PK_VPX_SAMPLE_TIME4 PRIMARY KEY (TIME_ID)
);


/*==============================================================*/
/* Index: VPX_SAMPLE_TIME4_U1                                   */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_SAMPLE_TIME4_U1 ON VPX_SAMPLE_TIME4(SAMPLE_TIME, SAMPLE_INTERVAL);

/*==============================================================*/
/* Index: VPX_SAMPLE_TIME4_M1                                   */
/*==============================================================*/
CREATE INDEX VPX_SAMPLE_TIME4_M1 ON VPX_SAMPLE_TIME4(ROLLUP_COUNTER);

--SET tablespace back to vcseat
SELECT PREFTABLESPACE('hs2');
/*==============================================================*/
/* Tables: VPX_HIST_STAT2_1 thru VPX_HIST_STAT2_85              */
/*==============================================================*/
CREATE TABLE VPX_HIST_STAT2_1 (
 COUNTER_ID  NUMERIC(38)  NOT NULL,
 TIME_ID     NUMERIC(38)  NOT NULL,
 STAT_VAL    NUMERIC(38)  NOT NULL
);
-- CREATE REMAINING HS TABLES
CREATE TABLE VPX_HIST_STAT2_2 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_3 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_4 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_5 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_6 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_7 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_8 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_9 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_10 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_11 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_12 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_13 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_14 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_15 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_16 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_17 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_18 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_19 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_20 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_21 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_22 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_23 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_24 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_25 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_26 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_27 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_28 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_29 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_30 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_31 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_32 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_33 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_34 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_35 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_36 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_37 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_38 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_39 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_40 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_41 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_42 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_43 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_44 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_45 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_46 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_47 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_48 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_49 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_50 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_51 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_52 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_53 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_54 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_55 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_56 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_57 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_58 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_59 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_60 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_61 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_62 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_63 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_64 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_65 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_66 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_67 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_68 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_69 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_70 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_71 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_72 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_73 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_74 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_75 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_76 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_77 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_78 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_79 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_80 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_81 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_82 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_83 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_84 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT2_85 (LIKE VPX_HIST_STAT2_1 INCLUDING DEFAULTS);

/*==============================================================*/
/* INDEXES: PK_VPX_HIST_STAT2_1 thru PK_VPX_HIST_STAT2_85       */
/*==============================================================*/
alter table VPX_HIST_STAT2_1 add constraint PK_VPX_HIST_STAT2_1 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_2 add constraint PK_VPX_HIST_STAT2_2 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_3 add constraint PK_VPX_HIST_STAT2_3 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_4 add constraint PK_VPX_HIST_STAT2_4 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_5 add constraint PK_VPX_HIST_STAT2_5 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_6 add constraint PK_VPX_HIST_STAT2_6 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_7 add constraint PK_VPX_HIST_STAT2_7 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_8 add constraint PK_VPX_HIST_STAT2_8 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_9 add constraint PK_VPX_HIST_STAT2_9 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_10 add constraint PK_VPX_HIST_STAT2_10 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_11 add constraint PK_VPX_HIST_STAT2_11 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_12 add constraint PK_VPX_HIST_STAT2_12 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_13 add constraint PK_VPX_HIST_STAT2_13 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_14 add constraint PK_VPX_HIST_STAT2_14 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_15 add constraint PK_VPX_HIST_STAT2_15 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_16 add constraint PK_VPX_HIST_STAT2_16 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_17 add constraint PK_VPX_HIST_STAT2_17 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_18 add constraint PK_VPX_HIST_STAT2_18 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_19 add constraint PK_VPX_HIST_STAT2_19 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_20 add constraint PK_VPX_HIST_STAT2_20 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_21 add constraint PK_VPX_HIST_STAT2_21 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_22 add constraint PK_VPX_HIST_STAT2_22 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_23 add constraint PK_VPX_HIST_STAT2_23 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_24 add constraint PK_VPX_HIST_STAT2_24 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_25 add constraint PK_VPX_HIST_STAT2_25 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_26 add constraint PK_VPX_HIST_STAT2_26 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_27 add constraint PK_VPX_HIST_STAT2_27 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_28 add constraint PK_VPX_HIST_STAT2_28 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_29 add constraint PK_VPX_HIST_STAT2_29 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_30 add constraint PK_VPX_HIST_STAT2_30 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_31 add constraint PK_VPX_HIST_STAT2_31 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_32 add constraint PK_VPX_HIST_STAT2_32 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_33 add constraint PK_VPX_HIST_STAT2_33 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_34 add constraint PK_VPX_HIST_STAT2_34 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_35 add constraint PK_VPX_HIST_STAT2_35 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_36 add constraint PK_VPX_HIST_STAT2_36 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_37 add constraint PK_VPX_HIST_STAT2_37 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_38 add constraint PK_VPX_HIST_STAT2_38 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_39 add constraint PK_VPX_HIST_STAT2_39 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_40 add constraint PK_VPX_HIST_STAT2_40 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_41 add constraint PK_VPX_HIST_STAT2_41 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_42 add constraint PK_VPX_HIST_STAT2_42 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_43 add constraint PK_VPX_HIST_STAT2_43 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_44 add constraint PK_VPX_HIST_STAT2_44 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_45 add constraint PK_VPX_HIST_STAT2_45 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_46 add constraint PK_VPX_HIST_STAT2_46 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_47 add constraint PK_VPX_HIST_STAT2_47 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_48 add constraint PK_VPX_HIST_STAT2_48 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_49 add constraint PK_VPX_HIST_STAT2_49 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_50 add constraint PK_VPX_HIST_STAT2_50 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_51 add constraint PK_VPX_HIST_STAT2_51 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_52 add constraint PK_VPX_HIST_STAT2_52 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_53 add constraint PK_VPX_HIST_STAT2_53 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_54 add constraint PK_VPX_HIST_STAT2_54 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_55 add constraint PK_VPX_HIST_STAT2_55 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_56 add constraint PK_VPX_HIST_STAT2_56 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_57 add constraint PK_VPX_HIST_STAT2_57 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_58 add constraint PK_VPX_HIST_STAT2_58 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_59 add constraint PK_VPX_HIST_STAT2_59 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_60 add constraint PK_VPX_HIST_STAT2_60 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_61 add constraint PK_VPX_HIST_STAT2_61 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_62 add constraint PK_VPX_HIST_STAT2_62 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_63 add constraint PK_VPX_HIST_STAT2_63 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_64 add constraint PK_VPX_HIST_STAT2_64 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_65 add constraint PK_VPX_HIST_STAT2_65 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_66 add constraint PK_VPX_HIST_STAT2_66 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_67 add constraint PK_VPX_HIST_STAT2_67 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_68 add constraint PK_VPX_HIST_STAT2_68 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_69 add constraint PK_VPX_HIST_STAT2_69 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_70 add constraint PK_VPX_HIST_STAT2_70 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_71 add constraint PK_VPX_HIST_STAT2_71 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_72 add constraint PK_VPX_HIST_STAT2_72 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_73 add constraint PK_VPX_HIST_STAT2_73 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_74 add constraint PK_VPX_HIST_STAT2_74 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_75 add constraint PK_VPX_HIST_STAT2_75 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_76 add constraint PK_VPX_HIST_STAT2_76 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_77 add constraint PK_VPX_HIST_STAT2_77 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_78 add constraint PK_VPX_HIST_STAT2_78 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_79 add constraint PK_VPX_HIST_STAT2_79 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_80 add constraint PK_VPX_HIST_STAT2_80 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_81 add constraint PK_VPX_HIST_STAT2_81 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_82 add constraint PK_VPX_HIST_STAT2_82 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_83 add constraint PK_VPX_HIST_STAT2_83 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_84 add constraint PK_VPX_HIST_STAT2_84 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT2_85 add constraint PK_VPX_HIST_STAT2_85 primary key (COUNTER_ID, TIME_ID);


/*==============================================================================*/
/* INDEXES: IX_VPX_HIST_STAT2_1_TID thru IX_VPX_HIST_STAT2_85_TID               */
/*==============================================================================*/
CREATE INDEX IX_VPX_HIST_STAT2_1_TID ON VPX_HIST_STAT2_1(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_2_TID ON VPX_HIST_STAT2_2(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_3_TID ON VPX_HIST_STAT2_3(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_4_TID ON VPX_HIST_STAT2_4(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_5_TID ON VPX_HIST_STAT2_5(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_6_TID ON VPX_HIST_STAT2_6(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_7_TID ON VPX_HIST_STAT2_7(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_8_TID ON VPX_HIST_STAT2_8(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_9_TID ON VPX_HIST_STAT2_9(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_10_TID ON VPX_HIST_STAT2_10(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_11_TID ON VPX_HIST_STAT2_11(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_12_TID ON VPX_HIST_STAT2_12(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_13_TID ON VPX_HIST_STAT2_13(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_14_TID ON VPX_HIST_STAT2_14(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_15_TID ON VPX_HIST_STAT2_15(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_16_TID ON VPX_HIST_STAT2_16(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_17_TID ON VPX_HIST_STAT2_17(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_18_TID ON VPX_HIST_STAT2_18(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_19_TID ON VPX_HIST_STAT2_19(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_20_TID ON VPX_HIST_STAT2_20(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_21_TID ON VPX_HIST_STAT2_21(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_22_TID ON VPX_HIST_STAT2_22(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_23_TID ON VPX_HIST_STAT2_23(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_24_TID ON VPX_HIST_STAT2_24(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_25_TID ON VPX_HIST_STAT2_25(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_26_TID ON VPX_HIST_STAT2_26(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_27_TID ON VPX_HIST_STAT2_27(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_28_TID ON VPX_HIST_STAT2_28(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_29_TID ON VPX_HIST_STAT2_29(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_30_TID ON VPX_HIST_STAT2_30(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_31_TID ON VPX_HIST_STAT2_31(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_32_TID ON VPX_HIST_STAT2_32(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_33_TID ON VPX_HIST_STAT2_33(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_34_TID ON VPX_HIST_STAT2_34(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_35_TID ON VPX_HIST_STAT2_35(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_36_TID ON VPX_HIST_STAT2_36(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_37_TID ON VPX_HIST_STAT2_37(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_38_TID ON VPX_HIST_STAT2_38(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_39_TID ON VPX_HIST_STAT2_39(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_40_TID ON VPX_HIST_STAT2_40(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_41_TID ON VPX_HIST_STAT2_41(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_42_TID ON VPX_HIST_STAT2_42(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_43_TID ON VPX_HIST_STAT2_43(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_44_TID ON VPX_HIST_STAT2_44(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_45_TID ON VPX_HIST_STAT2_45(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_46_TID ON VPX_HIST_STAT2_46(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_47_TID ON VPX_HIST_STAT2_47(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_48_TID ON VPX_HIST_STAT2_48(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_49_TID ON VPX_HIST_STAT2_49(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_50_TID ON VPX_HIST_STAT2_50(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_51_TID ON VPX_HIST_STAT2_51(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_52_TID ON VPX_HIST_STAT2_52(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_53_TID ON VPX_HIST_STAT2_53(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_54_TID ON VPX_HIST_STAT2_54(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_55_TID ON VPX_HIST_STAT2_55(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_56_TID ON VPX_HIST_STAT2_56(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_57_TID ON VPX_HIST_STAT2_57(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_58_TID ON VPX_HIST_STAT2_58(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_59_TID ON VPX_HIST_STAT2_59(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_60_TID ON VPX_HIST_STAT2_60(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_61_TID ON VPX_HIST_STAT2_61(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_62_TID ON VPX_HIST_STAT2_62(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_63_TID ON VPX_HIST_STAT2_63(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_64_TID ON VPX_HIST_STAT2_64(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_65_TID ON VPX_HIST_STAT2_65(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_66_TID ON VPX_HIST_STAT2_66(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_67_TID ON VPX_HIST_STAT2_67(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_68_TID ON VPX_HIST_STAT2_68(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_69_TID ON VPX_HIST_STAT2_69(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_70_TID ON VPX_HIST_STAT2_70(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_71_TID ON VPX_HIST_STAT2_71(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_72_TID ON VPX_HIST_STAT2_72(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_73_TID ON VPX_HIST_STAT2_73(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_74_TID ON VPX_HIST_STAT2_74(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_75_TID ON VPX_HIST_STAT2_75(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_76_TID ON VPX_HIST_STAT2_76(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_77_TID ON VPX_HIST_STAT2_77(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_78_TID ON VPX_HIST_STAT2_78(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_79_TID ON VPX_HIST_STAT2_79(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_80_TID ON VPX_HIST_STAT2_80(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_81_TID ON VPX_HIST_STAT2_81(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_82_TID ON VPX_HIST_STAT2_82(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_83_TID ON VPX_HIST_STAT2_83(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_84_TID ON VPX_HIST_STAT2_84(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT2_85_TID ON VPX_HIST_STAT2_85(TIME_ID);

--SET tablespace back to vcseat
SELECT PREFTABLESPACE('hs3');

/*==============================================================*/
/* Tables: VPX_HIST_STAT3_1 thru VPX_HIST_STAT3_32              */
/*==============================================================*/
CREATE TABLE VPX_HIST_STAT3_1 (
 COUNTER_ID  NUMERIC(38)  NOT NULL,
 TIME_ID     NUMERIC(38)  NOT NULL,
 STAT_VAL    NUMERIC(38)  NOT NULL
);
-- CREATE REMAINING HS TABLES
CREATE TABLE VPX_HIST_STAT3_2 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_3 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_4 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_5 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_6 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_7 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_8 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_9 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_10 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_11 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_12 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_13 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_14 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_15 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_16 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_17 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_18 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_19 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_20 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_21 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_22 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_23 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_24 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_25 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_26 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_27 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_28 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_29 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_30 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_31 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT3_32 (LIKE VPX_HIST_STAT3_1 INCLUDING DEFAULTS);

/*==============================================================*/
/* INDEXES: PK_VPX_HIST_STAT3_1 thru PK_VPX_HIST_STAT3_32       */
/*==============================================================*/
alter table VPX_HIST_STAT3_1 add constraint PK_VPX_HIST_STAT3_1 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_2 add constraint PK_VPX_HIST_STAT3_2 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_3 add constraint PK_VPX_HIST_STAT3_3 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_4 add constraint PK_VPX_HIST_STAT3_4 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_5 add constraint PK_VPX_HIST_STAT3_5 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_6 add constraint PK_VPX_HIST_STAT3_6 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_7 add constraint PK_VPX_HIST_STAT3_7 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_8 add constraint PK_VPX_HIST_STAT3_8 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_9 add constraint PK_VPX_HIST_STAT3_9 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_10 add constraint PK_VPX_HIST_STAT3_10 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_11 add constraint PK_VPX_HIST_STAT3_11 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_12 add constraint PK_VPX_HIST_STAT3_12 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_13 add constraint PK_VPX_HIST_STAT3_13 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_14 add constraint PK_VPX_HIST_STAT3_14 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_15 add constraint PK_VPX_HIST_STAT3_15 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_16 add constraint PK_VPX_HIST_STAT3_16 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_17 add constraint PK_VPX_HIST_STAT3_17 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_18 add constraint PK_VPX_HIST_STAT3_18 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_19 add constraint PK_VPX_HIST_STAT3_19 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_20 add constraint PK_VPX_HIST_STAT3_20 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_21 add constraint PK_VPX_HIST_STAT3_21 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_22 add constraint PK_VPX_HIST_STAT3_22 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_23 add constraint PK_VPX_HIST_STAT3_23 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_24 add constraint PK_VPX_HIST_STAT3_24 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_25 add constraint PK_VPX_HIST_STAT3_25 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_26 add constraint PK_VPX_HIST_STAT3_26 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_27 add constraint PK_VPX_HIST_STAT3_27 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_28 add constraint PK_VPX_HIST_STAT3_28 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_29 add constraint PK_VPX_HIST_STAT3_29 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_30 add constraint PK_VPX_HIST_STAT3_30 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_31 add constraint PK_VPX_HIST_STAT3_31 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT3_32 add constraint PK_VPX_HIST_STAT3_32 primary key (COUNTER_ID, TIME_ID);


/*==============================================================================*/
/* INDEXES: IX_VPX_HIST_STAT3_1_TID thru IX_VPX_HIST_STAT3_32_TID               */
/*==============================================================================*/
CREATE INDEX IX_VPX_HIST_STAT3_1_TID ON VPX_HIST_STAT3_1(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_2_TID ON VPX_HIST_STAT3_2(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_3_TID ON VPX_HIST_STAT3_3(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_4_TID ON VPX_HIST_STAT3_4(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_5_TID ON VPX_HIST_STAT3_5(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_6_TID ON VPX_HIST_STAT3_6(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_7_TID ON VPX_HIST_STAT3_7(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_8_TID ON VPX_HIST_STAT3_8(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_9_TID ON VPX_HIST_STAT3_9(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_10_TID ON VPX_HIST_STAT3_10(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_11_TID ON VPX_HIST_STAT3_11(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_12_TID ON VPX_HIST_STAT3_12(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_13_TID ON VPX_HIST_STAT3_13(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_14_TID ON VPX_HIST_STAT3_14(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_15_TID ON VPX_HIST_STAT3_15(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_16_TID ON VPX_HIST_STAT3_16(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_17_TID ON VPX_HIST_STAT3_17(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_18_TID ON VPX_HIST_STAT3_18(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_19_TID ON VPX_HIST_STAT3_19(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_20_TID ON VPX_HIST_STAT3_20(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_21_TID ON VPX_HIST_STAT3_21(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_22_TID ON VPX_HIST_STAT3_22(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_23_TID ON VPX_HIST_STAT3_23(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_24_TID ON VPX_HIST_STAT3_24(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_25_TID ON VPX_HIST_STAT3_25(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_26_TID ON VPX_HIST_STAT3_26(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_27_TID ON VPX_HIST_STAT3_27(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_28_TID ON VPX_HIST_STAT3_28(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_29_TID ON VPX_HIST_STAT3_29(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_30_TID ON VPX_HIST_STAT3_30(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_31_TID ON VPX_HIST_STAT3_31(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT3_32_TID ON VPX_HIST_STAT3_32(TIME_ID);

--SET tablespace back to vcseat
SELECT PREFTABLESPACE('hs4');

/*==============================================================*/
/* Tables: VPX_HIST_STAT4_1 thru VPX_HIST_STAT4_183             */
/*==============================================================*/
CREATE TABLE VPX_HIST_STAT4_1 (
 COUNTER_ID  NUMERIC(38)  NOT NULL,
 TIME_ID     NUMERIC(38)  NOT NULL,
 STAT_VAL    NUMERIC(38)  NOT NULL
);
-- CREATE REMAINING HS TABLES
CREATE TABLE VPX_HIST_STAT4_2 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_3 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_4 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_5 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_6 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_7 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_8 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_9 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_10 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_11 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_12 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_13 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_14 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_15 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_16 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_17 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_18 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_19 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_20 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_21 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_22 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_23 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_24 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_25 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_26 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_27 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_28 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_29 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_30 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_31 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_32 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_33 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_34 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_35 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_36 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_37 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_38 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_39 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_40 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_41 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_42 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_43 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_44 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_45 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_46 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_47 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_48 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_49 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_50 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_51 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_52 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_53 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_54 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_55 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_56 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_57 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_58 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_59 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_60 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_61 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_62 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_63 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_64 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_65 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_66 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_67 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_68 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_69 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_70 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_71 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_72 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_73 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_74 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_75 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_76 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_77 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_78 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_79 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_80 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_81 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_82 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_83 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_84 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_85 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_86 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_87 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_88 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_89 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_90 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_91 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_92 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_93 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_94 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_95 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_96 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_97 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_98 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_99 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_100 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_101 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_102 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_103 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_104 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_105 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_106 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_107 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_108 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_109 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_110 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_111 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_112 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_113 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_114 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_115 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_116 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_117 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_118 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_119 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_120 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_121 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_122 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_123 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_124 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_125 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_126 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_127 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_128 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_129 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_130 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_131 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_132 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_133 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_134 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_135 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_136 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_137 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_138 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_139 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_140 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_141 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_142 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_143 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_144 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_145 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_146 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_147 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_148 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_149 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_150 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_151 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_152 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_153 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_154 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_155 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_156 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_157 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_158 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_159 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_160 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_161 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_162 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_163 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_164 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_165 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_166 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_167 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_168 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_169 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_170 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_171 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_172 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_173 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_174 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_175 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_176 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_177 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_178 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_179 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_180 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_181 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_182 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT4_183 (LIKE VPX_HIST_STAT4_1 INCLUDING DEFAULTS);

/*==============================================================*/
/* INDEXES: PK_VPX_HIST_STAT4_1 thru PK_VPX_HIST_STAT4_183      */
/*==============================================================*/
alter table VPX_HIST_STAT4_1 add constraint PK_VPX_HIST_STAT4_1 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_2 add constraint PK_VPX_HIST_STAT4_2 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_3 add constraint PK_VPX_HIST_STAT4_3 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_4 add constraint PK_VPX_HIST_STAT4_4 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_5 add constraint PK_VPX_HIST_STAT4_5 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_6 add constraint PK_VPX_HIST_STAT4_6 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_7 add constraint PK_VPX_HIST_STAT4_7 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_8 add constraint PK_VPX_HIST_STAT4_8 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_9 add constraint PK_VPX_HIST_STAT4_9 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_10 add constraint PK_VPX_HIST_STAT4_10 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_11 add constraint PK_VPX_HIST_STAT4_11 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_12 add constraint PK_VPX_HIST_STAT4_12 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_13 add constraint PK_VPX_HIST_STAT4_13 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_14 add constraint PK_VPX_HIST_STAT4_14 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_15 add constraint PK_VPX_HIST_STAT4_15 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_16 add constraint PK_VPX_HIST_STAT4_16 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_17 add constraint PK_VPX_HIST_STAT4_17 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_18 add constraint PK_VPX_HIST_STAT4_18 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_19 add constraint PK_VPX_HIST_STAT4_19 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_20 add constraint PK_VPX_HIST_STAT4_20 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_21 add constraint PK_VPX_HIST_STAT4_21 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_22 add constraint PK_VPX_HIST_STAT4_22 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_23 add constraint PK_VPX_HIST_STAT4_23 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_24 add constraint PK_VPX_HIST_STAT4_24 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_25 add constraint PK_VPX_HIST_STAT4_25 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_26 add constraint PK_VPX_HIST_STAT4_26 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_27 add constraint PK_VPX_HIST_STAT4_27 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_28 add constraint PK_VPX_HIST_STAT4_28 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_29 add constraint PK_VPX_HIST_STAT4_29 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_30 add constraint PK_VPX_HIST_STAT4_30 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_31 add constraint PK_VPX_HIST_STAT4_31 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_32 add constraint PK_VPX_HIST_STAT4_32 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_33 add constraint PK_VPX_HIST_STAT4_33 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_34 add constraint PK_VPX_HIST_STAT4_34 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_35 add constraint PK_VPX_HIST_STAT4_35 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_36 add constraint PK_VPX_HIST_STAT4_36 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_37 add constraint PK_VPX_HIST_STAT4_37 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_38 add constraint PK_VPX_HIST_STAT4_38 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_39 add constraint PK_VPX_HIST_STAT4_39 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_40 add constraint PK_VPX_HIST_STAT4_40 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_41 add constraint PK_VPX_HIST_STAT4_41 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_42 add constraint PK_VPX_HIST_STAT4_42 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_43 add constraint PK_VPX_HIST_STAT4_43 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_44 add constraint PK_VPX_HIST_STAT4_44 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_45 add constraint PK_VPX_HIST_STAT4_45 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_46 add constraint PK_VPX_HIST_STAT4_46 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_47 add constraint PK_VPX_HIST_STAT4_47 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_48 add constraint PK_VPX_HIST_STAT4_48 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_49 add constraint PK_VPX_HIST_STAT4_49 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_50 add constraint PK_VPX_HIST_STAT4_50 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_51 add constraint PK_VPX_HIST_STAT4_51 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_52 add constraint PK_VPX_HIST_STAT4_52 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_53 add constraint PK_VPX_HIST_STAT4_53 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_54 add constraint PK_VPX_HIST_STAT4_54 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_55 add constraint PK_VPX_HIST_STAT4_55 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_56 add constraint PK_VPX_HIST_STAT4_56 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_57 add constraint PK_VPX_HIST_STAT4_57 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_58 add constraint PK_VPX_HIST_STAT4_58 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_59 add constraint PK_VPX_HIST_STAT4_59 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_60 add constraint PK_VPX_HIST_STAT4_60 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_61 add constraint PK_VPX_HIST_STAT4_61 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_62 add constraint PK_VPX_HIST_STAT4_62 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_63 add constraint PK_VPX_HIST_STAT4_63 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_64 add constraint PK_VPX_HIST_STAT4_64 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_65 add constraint PK_VPX_HIST_STAT4_65 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_66 add constraint PK_VPX_HIST_STAT4_66 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_67 add constraint PK_VPX_HIST_STAT4_67 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_68 add constraint PK_VPX_HIST_STAT4_68 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_69 add constraint PK_VPX_HIST_STAT4_69 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_70 add constraint PK_VPX_HIST_STAT4_70 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_71 add constraint PK_VPX_HIST_STAT4_71 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_72 add constraint PK_VPX_HIST_STAT4_72 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_73 add constraint PK_VPX_HIST_STAT4_73 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_74 add constraint PK_VPX_HIST_STAT4_74 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_75 add constraint PK_VPX_HIST_STAT4_75 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_76 add constraint PK_VPX_HIST_STAT4_76 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_77 add constraint PK_VPX_HIST_STAT4_77 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_78 add constraint PK_VPX_HIST_STAT4_78 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_79 add constraint PK_VPX_HIST_STAT4_79 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_80 add constraint PK_VPX_HIST_STAT4_80 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_81 add constraint PK_VPX_HIST_STAT4_81 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_82 add constraint PK_VPX_HIST_STAT4_82 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_83 add constraint PK_VPX_HIST_STAT4_83 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_84 add constraint PK_VPX_HIST_STAT4_84 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_85 add constraint PK_VPX_HIST_STAT4_85 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_86 add constraint PK_VPX_HIST_STAT4_86 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_87 add constraint PK_VPX_HIST_STAT4_87 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_88 add constraint PK_VPX_HIST_STAT4_88 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_89 add constraint PK_VPX_HIST_STAT4_89 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_90 add constraint PK_VPX_HIST_STAT4_90 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_91 add constraint PK_VPX_HIST_STAT4_91 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_92 add constraint PK_VPX_HIST_STAT4_92 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_93 add constraint PK_VPX_HIST_STAT4_93 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_94 add constraint PK_VPX_HIST_STAT4_94 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_95 add constraint PK_VPX_HIST_STAT4_95 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_96 add constraint PK_VPX_HIST_STAT4_96 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_97 add constraint PK_VPX_HIST_STAT4_97 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_98 add constraint PK_VPX_HIST_STAT4_98 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_99 add constraint PK_VPX_HIST_STAT4_99 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_100 add constraint PK_VPX_HIST_STAT4_100 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_101 add constraint PK_VPX_HIST_STAT4_101 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_102 add constraint PK_VPX_HIST_STAT4_102 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_103 add constraint PK_VPX_HIST_STAT4_103 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_104 add constraint PK_VPX_HIST_STAT4_104 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_105 add constraint PK_VPX_HIST_STAT4_105 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_106 add constraint PK_VPX_HIST_STAT4_106 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_107 add constraint PK_VPX_HIST_STAT4_107 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_108 add constraint PK_VPX_HIST_STAT4_108 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_109 add constraint PK_VPX_HIST_STAT4_109 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_110 add constraint PK_VPX_HIST_STAT4_110 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_111 add constraint PK_VPX_HIST_STAT4_111 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_112 add constraint PK_VPX_HIST_STAT4_112 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_113 add constraint PK_VPX_HIST_STAT4_113 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_114 add constraint PK_VPX_HIST_STAT4_114 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_115 add constraint PK_VPX_HIST_STAT4_115 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_116 add constraint PK_VPX_HIST_STAT4_116 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_117 add constraint PK_VPX_HIST_STAT4_117 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_118 add constraint PK_VPX_HIST_STAT4_118 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_119 add constraint PK_VPX_HIST_STAT4_119 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_120 add constraint PK_VPX_HIST_STAT4_120 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_121 add constraint PK_VPX_HIST_STAT4_121 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_122 add constraint PK_VPX_HIST_STAT4_122 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_123 add constraint PK_VPX_HIST_STAT4_123 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_124 add constraint PK_VPX_HIST_STAT4_124 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_125 add constraint PK_VPX_HIST_STAT4_125 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_126 add constraint PK_VPX_HIST_STAT4_126 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_127 add constraint PK_VPX_HIST_STAT4_127 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_128 add constraint PK_VPX_HIST_STAT4_128 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_129 add constraint PK_VPX_HIST_STAT4_129 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_130 add constraint PK_VPX_HIST_STAT4_130 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_131 add constraint PK_VPX_HIST_STAT4_131 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_132 add constraint PK_VPX_HIST_STAT4_132 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_133 add constraint PK_VPX_HIST_STAT4_133 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_134 add constraint PK_VPX_HIST_STAT4_134 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_135 add constraint PK_VPX_HIST_STAT4_135 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_136 add constraint PK_VPX_HIST_STAT4_136 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_137 add constraint PK_VPX_HIST_STAT4_137 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_138 add constraint PK_VPX_HIST_STAT4_138 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_139 add constraint PK_VPX_HIST_STAT4_139 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_140 add constraint PK_VPX_HIST_STAT4_140 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_141 add constraint PK_VPX_HIST_STAT4_141 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_142 add constraint PK_VPX_HIST_STAT4_142 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_143 add constraint PK_VPX_HIST_STAT4_143 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_144 add constraint PK_VPX_HIST_STAT4_144 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_145 add constraint PK_VPX_HIST_STAT4_145 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_146 add constraint PK_VPX_HIST_STAT4_146 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_147 add constraint PK_VPX_HIST_STAT4_147 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_148 add constraint PK_VPX_HIST_STAT4_148 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_149 add constraint PK_VPX_HIST_STAT4_149 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_150 add constraint PK_VPX_HIST_STAT4_150 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_151 add constraint PK_VPX_HIST_STAT4_151 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_152 add constraint PK_VPX_HIST_STAT4_152 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_153 add constraint PK_VPX_HIST_STAT4_153 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_154 add constraint PK_VPX_HIST_STAT4_154 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_155 add constraint PK_VPX_HIST_STAT4_155 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_156 add constraint PK_VPX_HIST_STAT4_156 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_157 add constraint PK_VPX_HIST_STAT4_157 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_158 add constraint PK_VPX_HIST_STAT4_158 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_159 add constraint PK_VPX_HIST_STAT4_159 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_160 add constraint PK_VPX_HIST_STAT4_160 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_161 add constraint PK_VPX_HIST_STAT4_161 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_162 add constraint PK_VPX_HIST_STAT4_162 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_163 add constraint PK_VPX_HIST_STAT4_163 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_164 add constraint PK_VPX_HIST_STAT4_164 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_165 add constraint PK_VPX_HIST_STAT4_165 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_166 add constraint PK_VPX_HIST_STAT4_166 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_167 add constraint PK_VPX_HIST_STAT4_167 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_168 add constraint PK_VPX_HIST_STAT4_168 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_169 add constraint PK_VPX_HIST_STAT4_169 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_170 add constraint PK_VPX_HIST_STAT4_170 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_171 add constraint PK_VPX_HIST_STAT4_171 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_172 add constraint PK_VPX_HIST_STAT4_172 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_173 add constraint PK_VPX_HIST_STAT4_173 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_174 add constraint PK_VPX_HIST_STAT4_174 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_175 add constraint PK_VPX_HIST_STAT4_175 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_176 add constraint PK_VPX_HIST_STAT4_176 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_177 add constraint PK_VPX_HIST_STAT4_177 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_178 add constraint PK_VPX_HIST_STAT4_178 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_179 add constraint PK_VPX_HIST_STAT4_179 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_180 add constraint PK_VPX_HIST_STAT4_180 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_181 add constraint PK_VPX_HIST_STAT4_181 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_182 add constraint PK_VPX_HIST_STAT4_182 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT4_183 add constraint PK_VPX_HIST_STAT4_183 primary key (COUNTER_ID, TIME_ID);


/*==============================================================================*/
/* INDEXES: IX_VPX_HIST_STAT4_1_TID thru IX_VPX_HIST_STAT4_183_TID              */
/*==============================================================================*/
CREATE INDEX IX_VPX_HIST_STAT4_1_TID ON VPX_HIST_STAT4_1(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_2_TID ON VPX_HIST_STAT4_2(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_3_TID ON VPX_HIST_STAT4_3(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_4_TID ON VPX_HIST_STAT4_4(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_5_TID ON VPX_HIST_STAT4_5(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_6_TID ON VPX_HIST_STAT4_6(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_7_TID ON VPX_HIST_STAT4_7(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_8_TID ON VPX_HIST_STAT4_8(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_9_TID ON VPX_HIST_STAT4_9(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_10_TID ON VPX_HIST_STAT4_10(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_11_TID ON VPX_HIST_STAT4_11(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_12_TID ON VPX_HIST_STAT4_12(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_13_TID ON VPX_HIST_STAT4_13(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_14_TID ON VPX_HIST_STAT4_14(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_15_TID ON VPX_HIST_STAT4_15(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_16_TID ON VPX_HIST_STAT4_16(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_17_TID ON VPX_HIST_STAT4_17(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_18_TID ON VPX_HIST_STAT4_18(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_19_TID ON VPX_HIST_STAT4_19(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_20_TID ON VPX_HIST_STAT4_20(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_21_TID ON VPX_HIST_STAT4_21(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_22_TID ON VPX_HIST_STAT4_22(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_23_TID ON VPX_HIST_STAT4_23(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_24_TID ON VPX_HIST_STAT4_24(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_25_TID ON VPX_HIST_STAT4_25(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_26_TID ON VPX_HIST_STAT4_26(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_27_TID ON VPX_HIST_STAT4_27(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_28_TID ON VPX_HIST_STAT4_28(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_29_TID ON VPX_HIST_STAT4_29(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_30_TID ON VPX_HIST_STAT4_30(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_31_TID ON VPX_HIST_STAT4_31(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_32_TID ON VPX_HIST_STAT4_32(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_33_TID ON VPX_HIST_STAT4_33(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_34_TID ON VPX_HIST_STAT4_34(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_35_TID ON VPX_HIST_STAT4_35(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_36_TID ON VPX_HIST_STAT4_36(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_37_TID ON VPX_HIST_STAT4_37(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_38_TID ON VPX_HIST_STAT4_38(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_39_TID ON VPX_HIST_STAT4_39(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_40_TID ON VPX_HIST_STAT4_40(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_41_TID ON VPX_HIST_STAT4_41(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_42_TID ON VPX_HIST_STAT4_42(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_43_TID ON VPX_HIST_STAT4_43(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_44_TID ON VPX_HIST_STAT4_44(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_45_TID ON VPX_HIST_STAT4_45(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_46_TID ON VPX_HIST_STAT4_46(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_47_TID ON VPX_HIST_STAT4_47(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_48_TID ON VPX_HIST_STAT4_48(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_49_TID ON VPX_HIST_STAT4_49(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_50_TID ON VPX_HIST_STAT4_50(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_51_TID ON VPX_HIST_STAT4_51(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_52_TID ON VPX_HIST_STAT4_52(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_53_TID ON VPX_HIST_STAT4_53(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_54_TID ON VPX_HIST_STAT4_54(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_55_TID ON VPX_HIST_STAT4_55(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_56_TID ON VPX_HIST_STAT4_56(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_57_TID ON VPX_HIST_STAT4_57(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_58_TID ON VPX_HIST_STAT4_58(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_59_TID ON VPX_HIST_STAT4_59(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_60_TID ON VPX_HIST_STAT4_60(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_61_TID ON VPX_HIST_STAT4_61(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_62_TID ON VPX_HIST_STAT4_62(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_63_TID ON VPX_HIST_STAT4_63(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_64_TID ON VPX_HIST_STAT4_64(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_65_TID ON VPX_HIST_STAT4_65(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_66_TID ON VPX_HIST_STAT4_66(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_67_TID ON VPX_HIST_STAT4_67(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_68_TID ON VPX_HIST_STAT4_68(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_69_TID ON VPX_HIST_STAT4_69(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_70_TID ON VPX_HIST_STAT4_70(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_71_TID ON VPX_HIST_STAT4_71(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_72_TID ON VPX_HIST_STAT4_72(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_73_TID ON VPX_HIST_STAT4_73(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_74_TID ON VPX_HIST_STAT4_74(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_75_TID ON VPX_HIST_STAT4_75(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_76_TID ON VPX_HIST_STAT4_76(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_77_TID ON VPX_HIST_STAT4_77(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_78_TID ON VPX_HIST_STAT4_78(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_79_TID ON VPX_HIST_STAT4_79(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_80_TID ON VPX_HIST_STAT4_80(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_81_TID ON VPX_HIST_STAT4_81(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_82_TID ON VPX_HIST_STAT4_82(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_83_TID ON VPX_HIST_STAT4_83(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_84_TID ON VPX_HIST_STAT4_84(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_85_TID ON VPX_HIST_STAT4_85(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_86_TID ON VPX_HIST_STAT4_86(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_87_TID ON VPX_HIST_STAT4_87(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_88_TID ON VPX_HIST_STAT4_88(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_89_TID ON VPX_HIST_STAT4_89(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_90_TID ON VPX_HIST_STAT4_90(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_91_TID ON VPX_HIST_STAT4_91(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_92_TID ON VPX_HIST_STAT4_92(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_93_TID ON VPX_HIST_STAT4_93(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_94_TID ON VPX_HIST_STAT4_94(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_95_TID ON VPX_HIST_STAT4_95(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_96_TID ON VPX_HIST_STAT4_96(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_97_TID ON VPX_HIST_STAT4_97(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_98_TID ON VPX_HIST_STAT4_98(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_99_TID ON VPX_HIST_STAT4_99(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_100_TID ON VPX_HIST_STAT4_100(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_101_TID ON VPX_HIST_STAT4_101(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_102_TID ON VPX_HIST_STAT4_102(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_103_TID ON VPX_HIST_STAT4_103(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_104_TID ON VPX_HIST_STAT4_104(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_105_TID ON VPX_HIST_STAT4_105(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_106_TID ON VPX_HIST_STAT4_106(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_107_TID ON VPX_HIST_STAT4_107(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_108_TID ON VPX_HIST_STAT4_108(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_109_TID ON VPX_HIST_STAT4_109(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_110_TID ON VPX_HIST_STAT4_110(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_111_TID ON VPX_HIST_STAT4_111(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_112_TID ON VPX_HIST_STAT4_112(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_113_TID ON VPX_HIST_STAT4_113(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_114_TID ON VPX_HIST_STAT4_114(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_115_TID ON VPX_HIST_STAT4_115(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_116_TID ON VPX_HIST_STAT4_116(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_117_TID ON VPX_HIST_STAT4_117(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_118_TID ON VPX_HIST_STAT4_118(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_119_TID ON VPX_HIST_STAT4_119(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_120_TID ON VPX_HIST_STAT4_120(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_121_TID ON VPX_HIST_STAT4_121(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_122_TID ON VPX_HIST_STAT4_122(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_123_TID ON VPX_HIST_STAT4_123(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_124_TID ON VPX_HIST_STAT4_124(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_125_TID ON VPX_HIST_STAT4_125(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_126_TID ON VPX_HIST_STAT4_126(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_127_TID ON VPX_HIST_STAT4_127(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_128_TID ON VPX_HIST_STAT4_128(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_129_TID ON VPX_HIST_STAT4_129(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_130_TID ON VPX_HIST_STAT4_130(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_131_TID ON VPX_HIST_STAT4_131(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_132_TID ON VPX_HIST_STAT4_132(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_133_TID ON VPX_HIST_STAT4_133(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_134_TID ON VPX_HIST_STAT4_134(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_135_TID ON VPX_HIST_STAT4_135(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_136_TID ON VPX_HIST_STAT4_136(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_137_TID ON VPX_HIST_STAT4_137(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_138_TID ON VPX_HIST_STAT4_138(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_139_TID ON VPX_HIST_STAT4_139(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_140_TID ON VPX_HIST_STAT4_140(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_141_TID ON VPX_HIST_STAT4_141(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_142_TID ON VPX_HIST_STAT4_142(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_143_TID ON VPX_HIST_STAT4_143(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_144_TID ON VPX_HIST_STAT4_144(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_145_TID ON VPX_HIST_STAT4_145(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_146_TID ON VPX_HIST_STAT4_146(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_147_TID ON VPX_HIST_STAT4_147(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_148_TID ON VPX_HIST_STAT4_148(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_149_TID ON VPX_HIST_STAT4_149(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_150_TID ON VPX_HIST_STAT4_150(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_151_TID ON VPX_HIST_STAT4_151(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_152_TID ON VPX_HIST_STAT4_152(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_153_TID ON VPX_HIST_STAT4_153(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_154_TID ON VPX_HIST_STAT4_154(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_155_TID ON VPX_HIST_STAT4_155(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_156_TID ON VPX_HIST_STAT4_156(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_157_TID ON VPX_HIST_STAT4_157(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_158_TID ON VPX_HIST_STAT4_158(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_159_TID ON VPX_HIST_STAT4_159(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_160_TID ON VPX_HIST_STAT4_160(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_161_TID ON VPX_HIST_STAT4_161(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_162_TID ON VPX_HIST_STAT4_162(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_163_TID ON VPX_HIST_STAT4_163(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_164_TID ON VPX_HIST_STAT4_164(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_165_TID ON VPX_HIST_STAT4_165(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_166_TID ON VPX_HIST_STAT4_166(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_167_TID ON VPX_HIST_STAT4_167(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_168_TID ON VPX_HIST_STAT4_168(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_169_TID ON VPX_HIST_STAT4_169(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_170_TID ON VPX_HIST_STAT4_170(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_171_TID ON VPX_HIST_STAT4_171(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_172_TID ON VPX_HIST_STAT4_172(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_173_TID ON VPX_HIST_STAT4_173(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_174_TID ON VPX_HIST_STAT4_174(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_175_TID ON VPX_HIST_STAT4_175(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_176_TID ON VPX_HIST_STAT4_176(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_177_TID ON VPX_HIST_STAT4_177(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_178_TID ON VPX_HIST_STAT4_178(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_179_TID ON VPX_HIST_STAT4_179(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_180_TID ON VPX_HIST_STAT4_180(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_181_TID ON VPX_HIST_STAT4_181(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_182_TID ON VPX_HIST_STAT4_182(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT4_183_TID ON VPX_HIST_STAT4_183(TIME_ID);

--SET tablespace back to vcseat
SELECT PREFTABLESPACE('hs1');

/*==============================================================*/
/* Tables: VPX_HIST_STAT1_1 thru VPX_HIST_STAT1_241             */
/*==============================================================*/
CREATE TABLE VPX_HIST_STAT1_1 (
 COUNTER_ID  NUMERIC(38)  NOT NULL,
 TIME_ID     NUMERIC(38)  NOT NULL,
 STAT_VAL    NUMERIC(38)  NOT NULL
);
-- CREATE REMAINING HS TABLES
CREATE TABLE VPX_HIST_STAT1_2 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_3 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_4 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_5 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_6 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_7 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_8 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_9 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_10 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_11 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_12 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_13 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_14 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_15 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_16 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_17 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_18 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_19 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_20 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_21 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_22 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_23 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_24 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_25 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_26 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_27 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_28 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_29 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_30 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_31 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_32 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_33 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_34 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_35 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_36 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_37 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_38 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_39 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_40 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_41 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_42 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_43 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_44 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_45 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_46 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_47 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_48 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_49 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_50 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_51 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_52 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_53 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_54 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_55 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_56 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_57 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_58 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_59 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_60 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_61 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_62 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_63 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_64 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_65 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_66 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_67 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_68 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_69 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_70 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_71 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_72 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_73 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_74 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_75 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_76 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_77 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_78 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_79 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_80 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_81 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_82 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_83 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_84 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_85 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_86 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_87 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_88 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_89 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_90 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_91 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_92 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_93 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_94 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_95 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_96 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_97 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_98 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_99 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_100 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_101 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_102 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_103 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_104 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_105 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_106 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_107 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_108 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_109 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_110 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_111 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_112 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_113 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_114 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_115 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_116 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_117 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_118 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_119 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_120 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_121 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_122 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_123 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_124 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_125 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_126 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_127 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_128 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_129 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_130 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_131 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_132 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_133 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_134 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_135 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_136 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_137 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_138 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_139 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_140 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_141 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_142 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_143 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_144 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_145 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_146 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_147 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_148 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_149 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_150 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_151 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_152 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_153 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_154 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_155 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_156 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_157 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_158 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_159 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_160 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_161 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_162 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_163 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_164 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_165 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_166 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_167 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_168 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_169 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_170 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_171 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_172 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_173 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_174 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_175 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_176 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_177 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_178 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_179 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_180 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_181 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_182 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_183 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_184 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_185 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_186 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_187 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_188 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_189 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_190 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_191 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_192 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_193 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_194 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_195 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_196 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_197 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_198 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_199 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_200 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_201 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_202 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_203 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_204 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_205 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_206 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_207 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_208 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_209 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_210 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_211 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_212 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_213 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_214 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_215 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_216 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_217 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_218 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_219 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_220 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_221 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_222 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_223 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_224 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_225 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_226 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_227 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_228 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_229 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_230 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_231 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_232 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_233 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_234 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_235 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_236 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_237 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_238 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_239 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_240 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);
CREATE TABLE VPX_HIST_STAT1_241 (LIKE VPX_HIST_STAT1_1 INCLUDING DEFAULTS);

/*==============================================================*/
/* INDEXES: PK_VPX_HIST_STAT1_1 thru PK_VPX_HIST_STAT1_241      */
/*==============================================================*/
alter table VPX_HIST_STAT1_1 add constraint PK_VPX_HIST_STAT1_1 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_2 add constraint PK_VPX_HIST_STAT1_2 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_3 add constraint PK_VPX_HIST_STAT1_3 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_4 add constraint PK_VPX_HIST_STAT1_4 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_5 add constraint PK_VPX_HIST_STAT1_5 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_6 add constraint PK_VPX_HIST_STAT1_6 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_7 add constraint PK_VPX_HIST_STAT1_7 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_8 add constraint PK_VPX_HIST_STAT1_8 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_9 add constraint PK_VPX_HIST_STAT1_9 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_10 add constraint PK_VPX_HIST_STAT1_10 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_11 add constraint PK_VPX_HIST_STAT1_11 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_12 add constraint PK_VPX_HIST_STAT1_12 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_13 add constraint PK_VPX_HIST_STAT1_13 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_14 add constraint PK_VPX_HIST_STAT1_14 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_15 add constraint PK_VPX_HIST_STAT1_15 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_16 add constraint PK_VPX_HIST_STAT1_16 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_17 add constraint PK_VPX_HIST_STAT1_17 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_18 add constraint PK_VPX_HIST_STAT1_18 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_19 add constraint PK_VPX_HIST_STAT1_19 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_20 add constraint PK_VPX_HIST_STAT1_20 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_21 add constraint PK_VPX_HIST_STAT1_21 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_22 add constraint PK_VPX_HIST_STAT1_22 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_23 add constraint PK_VPX_HIST_STAT1_23 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_24 add constraint PK_VPX_HIST_STAT1_24 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_25 add constraint PK_VPX_HIST_STAT1_25 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_26 add constraint PK_VPX_HIST_STAT1_26 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_27 add constraint PK_VPX_HIST_STAT1_27 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_28 add constraint PK_VPX_HIST_STAT1_28 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_29 add constraint PK_VPX_HIST_STAT1_29 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_30 add constraint PK_VPX_HIST_STAT1_30 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_31 add constraint PK_VPX_HIST_STAT1_31 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_32 add constraint PK_VPX_HIST_STAT1_32 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_33 add constraint PK_VPX_HIST_STAT1_33 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_34 add constraint PK_VPX_HIST_STAT1_34 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_35 add constraint PK_VPX_HIST_STAT1_35 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_36 add constraint PK_VPX_HIST_STAT1_36 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_37 add constraint PK_VPX_HIST_STAT1_37 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_38 add constraint PK_VPX_HIST_STAT1_38 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_39 add constraint PK_VPX_HIST_STAT1_39 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_40 add constraint PK_VPX_HIST_STAT1_40 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_41 add constraint PK_VPX_HIST_STAT1_41 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_42 add constraint PK_VPX_HIST_STAT1_42 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_43 add constraint PK_VPX_HIST_STAT1_43 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_44 add constraint PK_VPX_HIST_STAT1_44 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_45 add constraint PK_VPX_HIST_STAT1_45 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_46 add constraint PK_VPX_HIST_STAT1_46 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_47 add constraint PK_VPX_HIST_STAT1_47 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_48 add constraint PK_VPX_HIST_STAT1_48 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_49 add constraint PK_VPX_HIST_STAT1_49 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_50 add constraint PK_VPX_HIST_STAT1_50 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_51 add constraint PK_VPX_HIST_STAT1_51 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_52 add constraint PK_VPX_HIST_STAT1_52 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_53 add constraint PK_VPX_HIST_STAT1_53 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_54 add constraint PK_VPX_HIST_STAT1_54 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_55 add constraint PK_VPX_HIST_STAT1_55 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_56 add constraint PK_VPX_HIST_STAT1_56 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_57 add constraint PK_VPX_HIST_STAT1_57 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_58 add constraint PK_VPX_HIST_STAT1_58 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_59 add constraint PK_VPX_HIST_STAT1_59 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_60 add constraint PK_VPX_HIST_STAT1_60 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_61 add constraint PK_VPX_HIST_STAT1_61 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_62 add constraint PK_VPX_HIST_STAT1_62 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_63 add constraint PK_VPX_HIST_STAT1_63 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_64 add constraint PK_VPX_HIST_STAT1_64 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_65 add constraint PK_VPX_HIST_STAT1_65 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_66 add constraint PK_VPX_HIST_STAT1_66 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_67 add constraint PK_VPX_HIST_STAT1_67 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_68 add constraint PK_VPX_HIST_STAT1_68 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_69 add constraint PK_VPX_HIST_STAT1_69 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_70 add constraint PK_VPX_HIST_STAT1_70 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_71 add constraint PK_VPX_HIST_STAT1_71 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_72 add constraint PK_VPX_HIST_STAT1_72 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_73 add constraint PK_VPX_HIST_STAT1_73 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_74 add constraint PK_VPX_HIST_STAT1_74 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_75 add constraint PK_VPX_HIST_STAT1_75 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_76 add constraint PK_VPX_HIST_STAT1_76 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_77 add constraint PK_VPX_HIST_STAT1_77 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_78 add constraint PK_VPX_HIST_STAT1_78 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_79 add constraint PK_VPX_HIST_STAT1_79 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_80 add constraint PK_VPX_HIST_STAT1_80 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_81 add constraint PK_VPX_HIST_STAT1_81 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_82 add constraint PK_VPX_HIST_STAT1_82 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_83 add constraint PK_VPX_HIST_STAT1_83 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_84 add constraint PK_VPX_HIST_STAT1_84 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_85 add constraint PK_VPX_HIST_STAT1_85 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_86 add constraint PK_VPX_HIST_STAT1_86 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_87 add constraint PK_VPX_HIST_STAT1_87 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_88 add constraint PK_VPX_HIST_STAT1_88 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_89 add constraint PK_VPX_HIST_STAT1_89 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_90 add constraint PK_VPX_HIST_STAT1_90 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_91 add constraint PK_VPX_HIST_STAT1_91 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_92 add constraint PK_VPX_HIST_STAT1_92 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_93 add constraint PK_VPX_HIST_STAT1_93 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_94 add constraint PK_VPX_HIST_STAT1_94 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_95 add constraint PK_VPX_HIST_STAT1_95 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_96 add constraint PK_VPX_HIST_STAT1_96 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_97 add constraint PK_VPX_HIST_STAT1_97 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_98 add constraint PK_VPX_HIST_STAT1_98 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_99 add constraint PK_VPX_HIST_STAT1_99 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_100 add constraint PK_VPX_HIST_STAT1_100 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_101 add constraint PK_VPX_HIST_STAT1_101 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_102 add constraint PK_VPX_HIST_STAT1_102 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_103 add constraint PK_VPX_HIST_STAT1_103 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_104 add constraint PK_VPX_HIST_STAT1_104 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_105 add constraint PK_VPX_HIST_STAT1_105 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_106 add constraint PK_VPX_HIST_STAT1_106 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_107 add constraint PK_VPX_HIST_STAT1_107 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_108 add constraint PK_VPX_HIST_STAT1_108 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_109 add constraint PK_VPX_HIST_STAT1_109 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_110 add constraint PK_VPX_HIST_STAT1_110 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_111 add constraint PK_VPX_HIST_STAT1_111 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_112 add constraint PK_VPX_HIST_STAT1_112 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_113 add constraint PK_VPX_HIST_STAT1_113 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_114 add constraint PK_VPX_HIST_STAT1_114 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_115 add constraint PK_VPX_HIST_STAT1_115 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_116 add constraint PK_VPX_HIST_STAT1_116 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_117 add constraint PK_VPX_HIST_STAT1_117 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_118 add constraint PK_VPX_HIST_STAT1_118 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_119 add constraint PK_VPX_HIST_STAT1_119 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_120 add constraint PK_VPX_HIST_STAT1_120 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_121 add constraint PK_VPX_HIST_STAT1_121 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_122 add constraint PK_VPX_HIST_STAT1_122 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_123 add constraint PK_VPX_HIST_STAT1_123 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_124 add constraint PK_VPX_HIST_STAT1_124 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_125 add constraint PK_VPX_HIST_STAT1_125 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_126 add constraint PK_VPX_HIST_STAT1_126 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_127 add constraint PK_VPX_HIST_STAT1_127 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_128 add constraint PK_VPX_HIST_STAT1_128 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_129 add constraint PK_VPX_HIST_STAT1_129 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_130 add constraint PK_VPX_HIST_STAT1_130 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_131 add constraint PK_VPX_HIST_STAT1_131 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_132 add constraint PK_VPX_HIST_STAT1_132 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_133 add constraint PK_VPX_HIST_STAT1_133 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_134 add constraint PK_VPX_HIST_STAT1_134 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_135 add constraint PK_VPX_HIST_STAT1_135 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_136 add constraint PK_VPX_HIST_STAT1_136 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_137 add constraint PK_VPX_HIST_STAT1_137 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_138 add constraint PK_VPX_HIST_STAT1_138 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_139 add constraint PK_VPX_HIST_STAT1_139 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_140 add constraint PK_VPX_HIST_STAT1_140 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_141 add constraint PK_VPX_HIST_STAT1_141 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_142 add constraint PK_VPX_HIST_STAT1_142 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_143 add constraint PK_VPX_HIST_STAT1_143 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_144 add constraint PK_VPX_HIST_STAT1_144 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_145 add constraint PK_VPX_HIST_STAT1_145 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_146 add constraint PK_VPX_HIST_STAT1_146 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_147 add constraint PK_VPX_HIST_STAT1_147 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_148 add constraint PK_VPX_HIST_STAT1_148 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_149 add constraint PK_VPX_HIST_STAT1_149 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_150 add constraint PK_VPX_HIST_STAT1_150 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_151 add constraint PK_VPX_HIST_STAT1_151 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_152 add constraint PK_VPX_HIST_STAT1_152 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_153 add constraint PK_VPX_HIST_STAT1_153 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_154 add constraint PK_VPX_HIST_STAT1_154 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_155 add constraint PK_VPX_HIST_STAT1_155 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_156 add constraint PK_VPX_HIST_STAT1_156 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_157 add constraint PK_VPX_HIST_STAT1_157 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_158 add constraint PK_VPX_HIST_STAT1_158 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_159 add constraint PK_VPX_HIST_STAT1_159 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_160 add constraint PK_VPX_HIST_STAT1_160 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_161 add constraint PK_VPX_HIST_STAT1_161 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_162 add constraint PK_VPX_HIST_STAT1_162 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_163 add constraint PK_VPX_HIST_STAT1_163 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_164 add constraint PK_VPX_HIST_STAT1_164 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_165 add constraint PK_VPX_HIST_STAT1_165 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_166 add constraint PK_VPX_HIST_STAT1_166 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_167 add constraint PK_VPX_HIST_STAT1_167 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_168 add constraint PK_VPX_HIST_STAT1_168 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_169 add constraint PK_VPX_HIST_STAT1_169 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_170 add constraint PK_VPX_HIST_STAT1_170 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_171 add constraint PK_VPX_HIST_STAT1_171 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_172 add constraint PK_VPX_HIST_STAT1_172 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_173 add constraint PK_VPX_HIST_STAT1_173 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_174 add constraint PK_VPX_HIST_STAT1_174 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_175 add constraint PK_VPX_HIST_STAT1_175 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_176 add constraint PK_VPX_HIST_STAT1_176 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_177 add constraint PK_VPX_HIST_STAT1_177 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_178 add constraint PK_VPX_HIST_STAT1_178 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_179 add constraint PK_VPX_HIST_STAT1_179 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_180 add constraint PK_VPX_HIST_STAT1_180 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_181 add constraint PK_VPX_HIST_STAT1_181 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_182 add constraint PK_VPX_HIST_STAT1_182 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_183 add constraint PK_VPX_HIST_STAT1_183 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_184 add constraint PK_VPX_HIST_STAT1_184 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_185 add constraint PK_VPX_HIST_STAT1_185 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_186 add constraint PK_VPX_HIST_STAT1_186 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_187 add constraint PK_VPX_HIST_STAT1_187 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_188 add constraint PK_VPX_HIST_STAT1_188 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_189 add constraint PK_VPX_HIST_STAT1_189 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_190 add constraint PK_VPX_HIST_STAT1_190 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_191 add constraint PK_VPX_HIST_STAT1_191 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_192 add constraint PK_VPX_HIST_STAT1_192 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_193 add constraint PK_VPX_HIST_STAT1_193 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_194 add constraint PK_VPX_HIST_STAT1_194 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_195 add constraint PK_VPX_HIST_STAT1_195 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_196 add constraint PK_VPX_HIST_STAT1_196 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_197 add constraint PK_VPX_HIST_STAT1_197 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_198 add constraint PK_VPX_HIST_STAT1_198 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_199 add constraint PK_VPX_HIST_STAT1_199 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_200 add constraint PK_VPX_HIST_STAT1_200 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_201 add constraint PK_VPX_HIST_STAT1_201 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_202 add constraint PK_VPX_HIST_STAT1_202 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_203 add constraint PK_VPX_HIST_STAT1_203 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_204 add constraint PK_VPX_HIST_STAT1_204 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_205 add constraint PK_VPX_HIST_STAT1_205 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_206 add constraint PK_VPX_HIST_STAT1_206 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_207 add constraint PK_VPX_HIST_STAT1_207 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_208 add constraint PK_VPX_HIST_STAT1_208 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_209 add constraint PK_VPX_HIST_STAT1_209 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_210 add constraint PK_VPX_HIST_STAT1_210 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_211 add constraint PK_VPX_HIST_STAT1_211 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_212 add constraint PK_VPX_HIST_STAT1_212 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_213 add constraint PK_VPX_HIST_STAT1_213 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_214 add constraint PK_VPX_HIST_STAT1_214 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_215 add constraint PK_VPX_HIST_STAT1_215 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_216 add constraint PK_VPX_HIST_STAT1_216 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_217 add constraint PK_VPX_HIST_STAT1_217 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_218 add constraint PK_VPX_HIST_STAT1_218 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_219 add constraint PK_VPX_HIST_STAT1_219 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_220 add constraint PK_VPX_HIST_STAT1_220 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_221 add constraint PK_VPX_HIST_STAT1_221 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_222 add constraint PK_VPX_HIST_STAT1_222 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_223 add constraint PK_VPX_HIST_STAT1_223 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_224 add constraint PK_VPX_HIST_STAT1_224 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_225 add constraint PK_VPX_HIST_STAT1_225 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_226 add constraint PK_VPX_HIST_STAT1_226 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_227 add constraint PK_VPX_HIST_STAT1_227 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_228 add constraint PK_VPX_HIST_STAT1_228 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_229 add constraint PK_VPX_HIST_STAT1_229 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_230 add constraint PK_VPX_HIST_STAT1_230 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_231 add constraint PK_VPX_HIST_STAT1_231 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_232 add constraint PK_VPX_HIST_STAT1_232 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_233 add constraint PK_VPX_HIST_STAT1_233 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_234 add constraint PK_VPX_HIST_STAT1_234 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_235 add constraint PK_VPX_HIST_STAT1_235 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_236 add constraint PK_VPX_HIST_STAT1_236 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_237 add constraint PK_VPX_HIST_STAT1_237 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_238 add constraint PK_VPX_HIST_STAT1_238 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_239 add constraint PK_VPX_HIST_STAT1_239 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_240 add constraint PK_VPX_HIST_STAT1_240 primary key (COUNTER_ID, TIME_ID);
alter table VPX_HIST_STAT1_241 add constraint PK_VPX_HIST_STAT1_241 primary key (COUNTER_ID, TIME_ID);


/*==============================================================================*/
/* INDEXES: IX_VPX_HIST_STAT1_1_TID thru IX_VPX_HIST_STAT1_241_TID              */
/*==============================================================================*/
CREATE INDEX IX_VPX_HIST_STAT1_1_TID ON VPX_HIST_STAT1_1(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_2_TID ON VPX_HIST_STAT1_2(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_3_TID ON VPX_HIST_STAT1_3(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_4_TID ON VPX_HIST_STAT1_4(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_5_TID ON VPX_HIST_STAT1_5(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_6_TID ON VPX_HIST_STAT1_6(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_7_TID ON VPX_HIST_STAT1_7(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_8_TID ON VPX_HIST_STAT1_8(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_9_TID ON VPX_HIST_STAT1_9(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_10_TID ON VPX_HIST_STAT1_10(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_11_TID ON VPX_HIST_STAT1_11(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_12_TID ON VPX_HIST_STAT1_12(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_13_TID ON VPX_HIST_STAT1_13(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_14_TID ON VPX_HIST_STAT1_14(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_15_TID ON VPX_HIST_STAT1_15(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_16_TID ON VPX_HIST_STAT1_16(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_17_TID ON VPX_HIST_STAT1_17(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_18_TID ON VPX_HIST_STAT1_18(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_19_TID ON VPX_HIST_STAT1_19(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_20_TID ON VPX_HIST_STAT1_20(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_21_TID ON VPX_HIST_STAT1_21(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_22_TID ON VPX_HIST_STAT1_22(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_23_TID ON VPX_HIST_STAT1_23(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_24_TID ON VPX_HIST_STAT1_24(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_25_TID ON VPX_HIST_STAT1_25(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_26_TID ON VPX_HIST_STAT1_26(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_27_TID ON VPX_HIST_STAT1_27(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_28_TID ON VPX_HIST_STAT1_28(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_29_TID ON VPX_HIST_STAT1_29(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_30_TID ON VPX_HIST_STAT1_30(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_31_TID ON VPX_HIST_STAT1_31(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_32_TID ON VPX_HIST_STAT1_32(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_33_TID ON VPX_HIST_STAT1_33(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_34_TID ON VPX_HIST_STAT1_34(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_35_TID ON VPX_HIST_STAT1_35(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_36_TID ON VPX_HIST_STAT1_36(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_37_TID ON VPX_HIST_STAT1_37(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_38_TID ON VPX_HIST_STAT1_38(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_39_TID ON VPX_HIST_STAT1_39(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_40_TID ON VPX_HIST_STAT1_40(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_41_TID ON VPX_HIST_STAT1_41(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_42_TID ON VPX_HIST_STAT1_42(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_43_TID ON VPX_HIST_STAT1_43(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_44_TID ON VPX_HIST_STAT1_44(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_45_TID ON VPX_HIST_STAT1_45(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_46_TID ON VPX_HIST_STAT1_46(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_47_TID ON VPX_HIST_STAT1_47(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_48_TID ON VPX_HIST_STAT1_48(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_49_TID ON VPX_HIST_STAT1_49(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_50_TID ON VPX_HIST_STAT1_50(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_51_TID ON VPX_HIST_STAT1_51(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_52_TID ON VPX_HIST_STAT1_52(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_53_TID ON VPX_HIST_STAT1_53(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_54_TID ON VPX_HIST_STAT1_54(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_55_TID ON VPX_HIST_STAT1_55(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_56_TID ON VPX_HIST_STAT1_56(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_57_TID ON VPX_HIST_STAT1_57(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_58_TID ON VPX_HIST_STAT1_58(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_59_TID ON VPX_HIST_STAT1_59(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_60_TID ON VPX_HIST_STAT1_60(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_61_TID ON VPX_HIST_STAT1_61(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_62_TID ON VPX_HIST_STAT1_62(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_63_TID ON VPX_HIST_STAT1_63(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_64_TID ON VPX_HIST_STAT1_64(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_65_TID ON VPX_HIST_STAT1_65(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_66_TID ON VPX_HIST_STAT1_66(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_67_TID ON VPX_HIST_STAT1_67(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_68_TID ON VPX_HIST_STAT1_68(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_69_TID ON VPX_HIST_STAT1_69(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_70_TID ON VPX_HIST_STAT1_70(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_71_TID ON VPX_HIST_STAT1_71(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_72_TID ON VPX_HIST_STAT1_72(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_73_TID ON VPX_HIST_STAT1_73(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_74_TID ON VPX_HIST_STAT1_74(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_75_TID ON VPX_HIST_STAT1_75(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_76_TID ON VPX_HIST_STAT1_76(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_77_TID ON VPX_HIST_STAT1_77(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_78_TID ON VPX_HIST_STAT1_78(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_79_TID ON VPX_HIST_STAT1_79(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_80_TID ON VPX_HIST_STAT1_80(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_81_TID ON VPX_HIST_STAT1_81(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_82_TID ON VPX_HIST_STAT1_82(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_83_TID ON VPX_HIST_STAT1_83(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_84_TID ON VPX_HIST_STAT1_84(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_85_TID ON VPX_HIST_STAT1_85(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_86_TID ON VPX_HIST_STAT1_86(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_87_TID ON VPX_HIST_STAT1_87(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_88_TID ON VPX_HIST_STAT1_88(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_89_TID ON VPX_HIST_STAT1_89(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_90_TID ON VPX_HIST_STAT1_90(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_91_TID ON VPX_HIST_STAT1_91(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_92_TID ON VPX_HIST_STAT1_92(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_93_TID ON VPX_HIST_STAT1_93(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_94_TID ON VPX_HIST_STAT1_94(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_95_TID ON VPX_HIST_STAT1_95(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_96_TID ON VPX_HIST_STAT1_96(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_97_TID ON VPX_HIST_STAT1_97(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_98_TID ON VPX_HIST_STAT1_98(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_99_TID ON VPX_HIST_STAT1_99(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_100_TID ON VPX_HIST_STAT1_100(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_101_TID ON VPX_HIST_STAT1_101(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_102_TID ON VPX_HIST_STAT1_102(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_103_TID ON VPX_HIST_STAT1_103(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_104_TID ON VPX_HIST_STAT1_104(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_105_TID ON VPX_HIST_STAT1_105(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_106_TID ON VPX_HIST_STAT1_106(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_107_TID ON VPX_HIST_STAT1_107(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_108_TID ON VPX_HIST_STAT1_108(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_109_TID ON VPX_HIST_STAT1_109(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_110_TID ON VPX_HIST_STAT1_110(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_111_TID ON VPX_HIST_STAT1_111(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_112_TID ON VPX_HIST_STAT1_112(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_113_TID ON VPX_HIST_STAT1_113(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_114_TID ON VPX_HIST_STAT1_114(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_115_TID ON VPX_HIST_STAT1_115(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_116_TID ON VPX_HIST_STAT1_116(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_117_TID ON VPX_HIST_STAT1_117(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_118_TID ON VPX_HIST_STAT1_118(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_119_TID ON VPX_HIST_STAT1_119(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_120_TID ON VPX_HIST_STAT1_120(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_121_TID ON VPX_HIST_STAT1_121(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_122_TID ON VPX_HIST_STAT1_122(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_123_TID ON VPX_HIST_STAT1_123(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_124_TID ON VPX_HIST_STAT1_124(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_125_TID ON VPX_HIST_STAT1_125(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_126_TID ON VPX_HIST_STAT1_126(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_127_TID ON VPX_HIST_STAT1_127(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_128_TID ON VPX_HIST_STAT1_128(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_129_TID ON VPX_HIST_STAT1_129(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_130_TID ON VPX_HIST_STAT1_130(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_131_TID ON VPX_HIST_STAT1_131(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_132_TID ON VPX_HIST_STAT1_132(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_133_TID ON VPX_HIST_STAT1_133(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_134_TID ON VPX_HIST_STAT1_134(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_135_TID ON VPX_HIST_STAT1_135(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_136_TID ON VPX_HIST_STAT1_136(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_137_TID ON VPX_HIST_STAT1_137(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_138_TID ON VPX_HIST_STAT1_138(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_139_TID ON VPX_HIST_STAT1_139(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_140_TID ON VPX_HIST_STAT1_140(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_141_TID ON VPX_HIST_STAT1_141(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_142_TID ON VPX_HIST_STAT1_142(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_143_TID ON VPX_HIST_STAT1_143(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_144_TID ON VPX_HIST_STAT1_144(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_145_TID ON VPX_HIST_STAT1_145(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_146_TID ON VPX_HIST_STAT1_146(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_147_TID ON VPX_HIST_STAT1_147(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_148_TID ON VPX_HIST_STAT1_148(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_149_TID ON VPX_HIST_STAT1_149(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_150_TID ON VPX_HIST_STAT1_150(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_151_TID ON VPX_HIST_STAT1_151(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_152_TID ON VPX_HIST_STAT1_152(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_153_TID ON VPX_HIST_STAT1_153(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_154_TID ON VPX_HIST_STAT1_154(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_155_TID ON VPX_HIST_STAT1_155(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_156_TID ON VPX_HIST_STAT1_156(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_157_TID ON VPX_HIST_STAT1_157(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_158_TID ON VPX_HIST_STAT1_158(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_159_TID ON VPX_HIST_STAT1_159(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_160_TID ON VPX_HIST_STAT1_160(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_161_TID ON VPX_HIST_STAT1_161(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_162_TID ON VPX_HIST_STAT1_162(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_163_TID ON VPX_HIST_STAT1_163(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_164_TID ON VPX_HIST_STAT1_164(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_165_TID ON VPX_HIST_STAT1_165(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_166_TID ON VPX_HIST_STAT1_166(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_167_TID ON VPX_HIST_STAT1_167(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_168_TID ON VPX_HIST_STAT1_168(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_169_TID ON VPX_HIST_STAT1_169(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_170_TID ON VPX_HIST_STAT1_170(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_171_TID ON VPX_HIST_STAT1_171(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_172_TID ON VPX_HIST_STAT1_172(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_173_TID ON VPX_HIST_STAT1_173(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_174_TID ON VPX_HIST_STAT1_174(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_175_TID ON VPX_HIST_STAT1_175(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_176_TID ON VPX_HIST_STAT1_176(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_177_TID ON VPX_HIST_STAT1_177(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_178_TID ON VPX_HIST_STAT1_178(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_179_TID ON VPX_HIST_STAT1_179(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_180_TID ON VPX_HIST_STAT1_180(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_181_TID ON VPX_HIST_STAT1_181(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_182_TID ON VPX_HIST_STAT1_182(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_183_TID ON VPX_HIST_STAT1_183(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_184_TID ON VPX_HIST_STAT1_184(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_185_TID ON VPX_HIST_STAT1_185(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_186_TID ON VPX_HIST_STAT1_186(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_187_TID ON VPX_HIST_STAT1_187(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_188_TID ON VPX_HIST_STAT1_188(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_189_TID ON VPX_HIST_STAT1_189(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_190_TID ON VPX_HIST_STAT1_190(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_191_TID ON VPX_HIST_STAT1_191(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_192_TID ON VPX_HIST_STAT1_192(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_193_TID ON VPX_HIST_STAT1_193(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_194_TID ON VPX_HIST_STAT1_194(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_195_TID ON VPX_HIST_STAT1_195(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_196_TID ON VPX_HIST_STAT1_196(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_197_TID ON VPX_HIST_STAT1_197(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_198_TID ON VPX_HIST_STAT1_198(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_199_TID ON VPX_HIST_STAT1_199(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_200_TID ON VPX_HIST_STAT1_200(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_201_TID ON VPX_HIST_STAT1_201(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_202_TID ON VPX_HIST_STAT1_202(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_203_TID ON VPX_HIST_STAT1_203(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_204_TID ON VPX_HIST_STAT1_204(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_205_TID ON VPX_HIST_STAT1_205(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_206_TID ON VPX_HIST_STAT1_206(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_207_TID ON VPX_HIST_STAT1_207(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_208_TID ON VPX_HIST_STAT1_208(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_209_TID ON VPX_HIST_STAT1_209(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_210_TID ON VPX_HIST_STAT1_210(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_211_TID ON VPX_HIST_STAT1_211(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_212_TID ON VPX_HIST_STAT1_212(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_213_TID ON VPX_HIST_STAT1_213(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_214_TID ON VPX_HIST_STAT1_214(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_215_TID ON VPX_HIST_STAT1_215(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_216_TID ON VPX_HIST_STAT1_216(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_217_TID ON VPX_HIST_STAT1_217(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_218_TID ON VPX_HIST_STAT1_218(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_219_TID ON VPX_HIST_STAT1_219(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_220_TID ON VPX_HIST_STAT1_220(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_221_TID ON VPX_HIST_STAT1_221(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_222_TID ON VPX_HIST_STAT1_222(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_223_TID ON VPX_HIST_STAT1_223(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_224_TID ON VPX_HIST_STAT1_224(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_225_TID ON VPX_HIST_STAT1_225(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_226_TID ON VPX_HIST_STAT1_226(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_227_TID ON VPX_HIST_STAT1_227(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_228_TID ON VPX_HIST_STAT1_228(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_229_TID ON VPX_HIST_STAT1_229(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_230_TID ON VPX_HIST_STAT1_230(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_231_TID ON VPX_HIST_STAT1_231(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_232_TID ON VPX_HIST_STAT1_232(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_233_TID ON VPX_HIST_STAT1_233(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_234_TID ON VPX_HIST_STAT1_234(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_235_TID ON VPX_HIST_STAT1_235(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_236_TID ON VPX_HIST_STAT1_236(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_237_TID ON VPX_HIST_STAT1_237(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_238_TID ON VPX_HIST_STAT1_238(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_239_TID ON VPX_HIST_STAT1_239(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_240_TID ON VPX_HIST_STAT1_240(TIME_ID);
CREATE INDEX IX_VPX_HIST_STAT1_241_TID ON VPX_HIST_STAT1_241(TIME_ID);

--Reset tablespace back to default
RESET default_tablespace;

/*==============================================================*/
/* Table: VPX_PROFILE                                           */
/*==============================================================*/
create table VPX_PROFILE (
   PROFILE_ID                  NUMERIC(38)                  not null,
   COMPLIANCE_STATUS           NUMERIC(1),
   PROFILE_NAME                VARCHAR(512),
   MODIFIED_TIME               TIMESTAMP,
   CONFIG_INFO                 TEXT,
   TYPE_CODE                   NUMERIC(3),
   CREATED_TIME                TIMESTAMP  default CURRENT_TIMESTAMP not null,
   constraint PK_VPX_PROF primary key  (PROFILE_ID)
)
;

/*==============================================================*/
/* Table: VPX_HOST_PROFILE                                      */
/*==============================================================*/
create table VPX_HOST_PROFILE (
   PROFILE_ID                   NUMERIC(38)                  not null,
   REF_HOST_ENTITY_ID           BIGINT,
   CREATED_TIME                 TIMESTAMP,
   constraint PK_VPX_HOST_PROF primary key  (PROFILE_ID),
   constraint FK_VPX_HP_REF_VPX_PROF foreign key (PROFILE_ID)
      references VPX_PROFILE (PROFILE_ID)
         on delete cascade,
   constraint FK_VPX_HP_REF_VPX_HOST foreign key (REF_HOST_ENTITY_ID)
      references VPX_HOST (ID)
         on delete set null
)
;

/*==============================================================*/
/* Table: VPX_PROFILE_ANSWER_FILE                               */
/*==============================================================*/

create table VPX_PROFILE_ANSWER_FILE (
   ANSWERFILE_ID              NUMERIC(38)                  not null,
   HOST_ID                    BIGINT                          not null,
   STATUS                     NUMERIC(1),
   CREATED_TIME               TIMESTAMP,
   MODIFIED_TIME              TIMESTAMP,
   USER_INPUT                 TEXT,
   constraint PK_VPX_PROF_ANSFILE primary key  (ANSWERFILE_ID),
   constraint FK_VPX_ANSFILE_REF_VPX_HOST foreign key (HOST_ID)
      references VPX_HOST (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_PROFILE_HOST_SPEC                                 */
/*==============================================================*/

create table VPX_PROFILE_HOST_SPEC   (
   HOST_ID                    BIGINT                          not null,
   CREATED_TIME               TIMESTAMP WITH TIME ZONE,
   MODIFIED_TIME              TIMESTAMP WITH TIME ZONE,
   START_TIME                 TIMESTAMP WITH TIME ZONE,
   CHANGE_ID                  BIGINT,
   HOST_SPEC                  TEXT,
   constraint PK_VPX_PROF_HOSTSPEC primary key  (HOST_ID)
)
;

/*==============================================================*/
/* Table: VPX_COMPLIANCE_STATUS                                 */
/*==============================================================*/
create table VPX_COMPLIANCE_STATUS (
   COMPLIANCE_STATUS_ID           NUMERIC(38)                 not null,
   PROFILE_ID                     NUMERIC(38)                  not null,
   ENTITY_ID                      BIGINT                      not null,
   STATUS_CD                      NUMERIC(3),
   CREATED_TIME                   TIMESTAMP,
   FAILURE_INFO                   TEXT,
   constraint PK_VPX_COMP_STAT primary key  (COMPLIANCE_STATUS_ID),
   constraint FK_VPX_COMP_REF_VPX_PROF foreign key (PROFILE_ID)
      references VPX_PROFILE (PROFILE_ID)
         on delete cascade,
   constraint FK_VPX_HP_REF_VPX_ENTI foreign key (ENTITY_ID)
      references VPX_ENTITY (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_PROFILE_ENTITY_ASSOCIATION                        */
/*==============================================================*/
create table VPX_PROFILE_ENTITY_ASSOCIATION (
   PROFILE_ID                   NUMERIC(38)                  not null,
   ENTITY_ID                    BIGINT               not null,
   constraint PK_VPX_ENT_ASSO primary key  (PROFILE_ID, ENTITY_ID),
   constraint FK_VPX_ENT_ASSO_REF_VPX_PROF foreign key (PROFILE_ID)
      references VPX_PROFILE (PROFILE_ID)
         on delete cascade,
   constraint FK_VPX_ENT_ASSO_VPX_ENTI foreign key (ENTITY_ID)
      references VPX_ENTITY (ID)
         on delete cascade
)
;


/*==============================================================*/
/* Table: VPX_ENTITY_LAST_EVENT                                 */
/*==============================================================*/
create table VPX_ENTITY_LAST_EVENT(
   ENTITY_ID           bigint       default 0    not null,
   EVENT_TYPE          VARCHAR(255)             not null,
   LAST_EVENT_ID       INTEGER                   not null,
  constraint PK_VPX_LAST_EVENT primary key  (ENTITY_ID, EVENT_TYPE)
 );

CREATE INDEX VPX_ENTITY_LAST_EVENT_F1 ON VPX_ENTITY_LAST_EVENT(LAST_EVENT_ID);

/*==============================================================*/
/* Table: VPX_STAT_DEV_TYPE_DEF                                 */
/*==============================================================*/
create table VPX_STAT_DEV_TYPE_DEF (
   DEVICE_TYPE_ID           NUMERIC(10)                  not null,
   DEVICE_TYPE_NAME         VARCHAR(255)             not null,
   constraint PK_VPX_STAT_DEV_TYPE_DEF primary key  (DEVICE_TYPE_ID)
);

/*==============================================================*/
/* Index: VPX_STAT_DEV_TYPE_DEF_U1                              */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_STAT_DEV_TYPE_DEF_U1 ON VPX_STAT_DEV_TYPE_DEF(DEVICE_TYPE_NAME);

/*==============================================================*/
/* Table: VPX_STAT_DEV_TYPE                                     */
/*==============================================================*/
create table VPX_STAT_DEV_TYPE (
   DEVICE_ID           NUMERIC(38)               not null,
   DEVICE_TYPE_ID      NUMERIC(10)               not null,
   constraint PK_VPX_STAT_DEV_TYPE primary key  (DEVICE_ID, DEVICE_TYPE_ID),
   constraint FK_VPX_STAT_DEV_TYPE2 foreign key(DEVICE_TYPE_ID)
      references VPX_STAT_DEV_TYPE_DEF (DEVICE_TYPE_ID)
);

/*==============================================================*/
/* Table: VPX_HOST_INTERNAL_CAPABILITY                          */
/*==============================================================*/
create table VPX_HOST_INTERNAL_CAPABILITY(
   HOST_ID                      BIGINT                   not null,
   ENUMERATE_EXTENTS_FLG        NUMERIC(1) DEFAULT 0     not null,
   FAST_SUSPEND_RESUME_FLG      NUMERIC(1) DEFAULT 0     not null,
   SVM_VMX_DISKCOPY_FLG         NUMERIC(1) DEFAULT 0     not null,
   LUN_DISPLAY_NAME_FLG         NUMERIC(1) DEFAULT 0     not null,
   HOSTPROFILE_ENGINE_FLG       NUMERIC(1) DEFAULT 0     not null,
   INTERNAL_CAPABILITY		TEXT,
  constraint PK_HOST_INTERVAL_CAPABILITY primary key  (HOST_ID),
   constraint FK_INTERVAL_CAPABILITY_HOST foreign key(HOST_ID)
      references VPX_HOST (ID) on delete cascade
 );


/*==============================================================*/
/* Table: VPX_COMPUTE_RES_FAILOVER_HOST                         */
/*==============================================================*/
create table VPX_COMPUTE_RES_FAILOVER_HOST (
   COMP_RES_ID               bigint                  not null,
   HOST_ID                   bigint                  not null,
   constraint PK_COMPUTE_RES_FAILOVER_HOST primary key  (COMP_RES_ID, HOST_ID),
   constraint FK_VPX_FAILOVER_HOST_REF1 foreign key (COMP_RES_ID)
         references VPX_COMPUTE_RESOURCE (ID) ,
   constraint FK_VPX_FAILOVER_HOST_REF2 foreign key (HOST_ID)
      references VPX_HOST (ID)  on delete cascade
)
;

/*==============================================================*/
/* Index: VPX_COMP_RES_FAILOVER_HOST_F1                         */
/*==============================================================*/
create unique index VPX_COMP_RES_FAILOVER_HOST_F1 on VPX_COMPUTE_RES_FAILOVER_HOST
(HOST_ID
)
;

/*==============================================================*/
/* Table: VPX_VM_DS_SPACE                                       */
/*==============================================================*/
create table VPX_VM_DS_SPACE (
   VM_ID                   bigint               not null,
   DS_ID                   bigint                  not null,
   COMMITED_SPACE          NUMERIC(38),
   UNCOMMITED_SPACE        NUMERIC(38),
   UNSHARED_SPACE          NUMERIC(38),
   UPDATED_TIME            TIMESTAMP,
   constraint PK_VPX_VM_DS_SPACE primary key (VM_ID, DS_ID),
   constraint FK_VPX_VM_DS_SPACE1 foreign key (VM_ID)
         references VPX_VM (ID)  on delete cascade,
   constraint FK_VPX_VM_DS_SPACE2 foreign key (DS_ID)
      references VPX_DATASTORE (ID)
)
;

/*==============================================================*/
/* Index: VPX_VM_DS_SPACE_F1                                    */
/*==============================================================*/
create index VPX_VM_DS_SPACE_F1 on VPX_VM_DS_SPACE
(DS_ID
)
;


/*==============================================================*/
/* Table: VPX_NON_ORM_VM_CONFIG_INFO                            */
/*==============================================================*/
CREATE TABLE VPX_NON_ORM_VM_CONFIG_INFO (
        ID                              BIGINT NOT NULL,
        CHANGE_VERSION                  VARCHAR(255),
        CHANGE_TRACKING_ENABLED         NUMERIC(1),
        CPU_HOT_ADD_ENABLED             NUMERIC(1),
        CPU_HOT_REMOVE_ENABLED          NUMERIC(1),
        MEM_HOT_ADD_ENABLED             NUMERIC(1),
        VFLASH_CACHE_RESERVATION        NUMERIC(22),
        NETWORK_SHAPER_AVERAGE_BPS      VARCHAR(22),
        NETWORK_SHAPER_BURST_SIZE       VARCHAR(22),
        NETWORK_SHAPER_ENABLED_FLG      NUMERIC(1),
        NETWORK_SHAPER_PEAK_BPS         VARCHAR(22),
        HARDWARE_NUM                    INTEGER,
        HARDWARE_MEMORY                 INTEGER,
        HARDWARE_CORES                  INTEGER,
        VIRTUAL_ICH7M_PRESENT           NUMERIC(1) default 0,
        VIRTUAL_SMC_PRESENT             NUMERIC(1) default 0,
        CONPREFE_CL_PO_SUSPEND_FLG      NUMERIC(1),
        CONPREFE_SCR_POWER_ON_FLG       NUMERIC(1),
        CONPREFE_POWERONWHENOPENED_FLG  NUMERIC(1),
        TOOLS_BEFORE_GUEST_STANDBY_FLG  NUMERIC(1),
        TOOLS_BEFORE_GUEST_REBOOT_FLG   NUMERIC(1),
        TOOLS_BEFORE_GUESTSHUTDOWN_FLG  NUMERIC(1),
        TOOLS_TOOLS_UPGRADE_POLICY      VARCHAR(255),
        TOOLS_AFTER_RESUME_FLG          NUMERIC(1),
        TOOLS_AFTER_POWER_ON_FLG        NUMERIC(1),
        TOOLS_SYNC_TIME_WITH_HOST_FLG   NUMERIC(1),
        TOOLS_PENDING_CUSTOMIZATION     VARCHAR(255),
        TOOLS_TOOLS_VERSION             INT,
        TOOLS_LASTINSTALL_COUNTER       INT,
        GUEST_FULL_NAME                 VARCHAR(512),
        INSTANCE_UUID                   VARCHAR(255),
        UUID                            VARCHAR(255),
        ANNOTATION                      VARCHAR(2000),
        VERSION                         VARCHAR(255),
        TEMPLATE_FLG                    NUMERIC(1),
        MEM_ALLOCATION_OVERHEAD_LIMIT   VARCHAR(22),
        MEMORY_ALLOCATION_RESERVATION   VARCHAR(22),
        MEMORY_ALLOCATION_LIMIT         VARCHAR(22),
        MEM_ALLOCATION_SHARES_SHARES    INT,
        MEM_ALLOCATION_SHARES_LEVEL     VARCHAR(255),
        MEM_ALLOCEXPAN_RESERVATION_FLG  NUMERIC(1),
        HOT_PLUG_MEMORY_LIMIT           VARCHAR(22),
        FILES_LOG_DIRECTORY             VARCHAR(255),
        FILES_SNAPSHOT_DIRECTORY        VARCHAR(255),
        FILES_VM_PATH_NAME              VARCHAR(512),
        FILES_SUSPEND_DIRECTORY         VARCHAR(255),
        FILES_FTMETADATA_DIRECTORY      VARCHAR(255),
        ALTERNATE_GUEST_NAME            VARCHAR(255),
        SWAP_PLACEMENT                  VARCHAR(255),
        LOCATION_ID                     VARCHAR(255),
        GUEST_ID                        VARCHAR(255),
        BOOT_OPTIONENTER_BIOSSETUP_FLG  NUMERIC(1),
        BOOT_OPTION_BOOT_DELAY          VARCHAR(22),
        BOOT_OPTION_RETRY_ENABLED_FLG   NUMERIC(1),
        BOOT_OPTION_RETRY_DELAY         NUMERIC(22),
        BOOT_OPTION_EFI_SB_ENABLED      NUMERIC(1),
        CPU_ALLOCATION_OVERHEAD_LIMIT   VARCHAR(22),
        CPU_ALLOCATION_RESERVATION      VARCHAR(22),
        CPU_ALLOCATION_LIMIT            VARCHAR(22),
        CPU_ALLOCATION_SHARES_SHARES    INT,
        CPU_ALLOCATION_SHARES_LEVEL     VARCHAR(255),
        C_ALLOC_EXPANDABLE_RESERV_FLG   NUMERIC(1),
        DEF_PO_OPS_DEFAULT_RESET_TYPE   VARCHAR(255),
        DEF_PO_O_DEFAULT_SUSPEND_TYPE   VARCHAR(255),
        DEF_POWER_OPS_SUSPEND_TYPE      VARCHAR(255),
        DEF_POWER_OPS_STANDBY_ACTION    VARCHAR(255),
        DEF_PO_O_DEF_POWER_OFF_TYPE     VARCHAR(255),
        DEFAULT_POWER_OPS_RESET_TYPE    VARCHAR(255),
        DEF_POWER_OPS_POWER_OFF_TYPE    VARCHAR(255),
        H_PLUG_MEMORY_INCREMENT_SIZE    VARCHAR(22),
        NAME                            VARCHAR(255),
        NPIV_WORLD_WIDE_NAME_TYPE       VARCHAR(255),
        NPIV_TEMP_DISABLED              NUMERIC(1),
        NPIV_ON_RDM                     NUMERIC(1),
        NPIV_DESIRED_NWWN               INT,
        NPIV_DESIRED_PWWN               INT,
        MODIFIED                        TIMESTAMP,
        DISK_UUID_ENABLED_FLG           NUMERIC(1),
        SNAPSHOT_DISABLED_FLG           NUMERIC(1),
        RECORD_REPLAY_ENABLED_FLG       NUMERIC(1),
        FAULT_TOLERANCE_TYPE            VARCHAR(255),
        RUN_WITH_DEBUG_INFO_FLG         NUMERIC(1),
        VIRTUAL_MMU_USAGE               VARCHAR(255),
        VIRTUAL_EXEC_USAGE              VARCHAR(255),
        ENABLE_LOGGING_FLG              NUMERIC(1),
        SNAPSHOT_LOCKED_FLG             NUMERIC(1),
        HT_SHARING                      VARCHAR(255),
        DISABLE_ACCELERATION_FLG        NUMERIC(1),
        FL_SNAPSHOT_POWER_OFF_BEHAVIOR  VARCHAR(255),
        FLAGS_MONITOR_TYPE              VARCHAR(255),
        USE_TOE_FLG                     NUMERIC(1),
        MANAGED_BY_EXT_KEY              VARCHAR(255),
        MANAGED_BY_TYPE                 VARCHAR(255),
        FIRMWARE                        VARCHAR(255),
        MAX_MKS_CONNECTIONS             INTEGER,
        NESTED_HV_ENABLED               NUMERIC(1) default 0,
        VIRTUAL_PMC_ENABLED             NUMERIC(1) default 0,
        SCHED_HW_UPGRADE_POLICY         VARCHAR(22) default 'never',
        SCHED_HW_UPGRADE_VERSION        VARCHAR(22),
        SCHED_HW_UPGRADE_STATUS         VARCHAR(22) default 'none',
        LATENCY_SENSITIVITY             INT,
        LATENCY_LEVEL                   VARCHAR(22) default 'normal',
        GUEST_AUTOLOCK_ENABLED          NUMERIC(1) default 0,
        MEM_RES_LOCKED_MAX              NUMERIC(1) default 0,
        VM_OBJECTID                     VARCHAR(255),
        SWAP_OBJECTID                   VARCHAR(255),
        MESSAGE_BUS_TUNNEL_ENABLED      INTEGER,
        GUEST_INTEGRITY_INFO_ENABLED    NUMERIC(1),
        MIGRATE_ENCRYPTION              VARCHAR(15),
        PRESERVED_SWAP_ONPOWEROFF_FLG   NUMERIC(1),
        SWAP_DIR                        VARCHAR(255),
        VM_ID                           BIGINT NOT NULL,
        CREATE_DATE                     TIMESTAMP,
        VVTD_ENABLED                    NUMERIC(1),
        VBS_ENABLED                     NUMERIC(1),
        constraint PK_N_VM_CONFIG_INFO primary key (ID),
        constraint FK_N_VM_CONFIG_INFO_REF_VPX_VM foreign key(VM_ID)
           references VPX_VM (ID) on delete cascade
)
;
CREATE INDEX VPXI_NORM_VM_ID ON VPX_NON_ORM_VM_CONFIG_INFO(VM_ID);

/*
 * Aggressive autovacuum for VPX_NON_ORM_VM_CONFIG_INFO to handle huge
 * amount of updates.
 */
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_NON_ORM_VM_CONFIG_INFO SET
                    (toast.autovacuum_vacuum_cost_limit = 1000);

CREATE INDEX VPXI_N_BOOT_OPTIN_RETRY_DELY ON
             VPX_NON_ORM_VM_CONFIG_INFO(BOOT_OPTION_RETRY_DELAY);

/*==============================================================*/
/* Table: VPX_VM_TEXT                                           */
/*==============================================================*/
CREATE TABLE VPX_VM_TEXT (
   ID             BIGINT NOT NULL,
   TYPE_ID        INT NOT NULL,
   TEXT_VALUE     TEXT,
   VM_ID          BIGINT NOT NULL,
   constraint PK_VM_TEXT primary key (ID, TYPE_ID),
   constraint FK_VM_TEXT_VM foreign key(VM_ID)
      references VPX_VM (ID) on delete cascade
)
;
CREATE INDEX VPXI_VM_TEXT_VM_ID ON VPX_VM_TEXT(VM_ID);

/*
 * Aggressive autovacuum for VPX_VM_TEXT to reduce fragmentation caused by huge
 * amount of updates.
 */
ALTER TABLE VPX_VM_TEXT SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VM_TEXT SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VM_TEXT SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_VM_TEXT SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VM_TEXT SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VM_TEXT SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_VM_TEXT SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VM_TEXT SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VM_TEXT SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_VM_TEXT SET (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_VDEVICE_BACKING_REL                               */
/*==============================================================*/
CREATE TABLE VPX_VDEVICE_BACKING_REL (
        BACKING_ID      INT NOT NULL,
        VPX_TYPE        VARCHAR(255),
        VM_ID           BIGINT,
        UPDATE_KEY      INT,
        constraint PK_VPX_VDEVICE_BACKING_REL primary key (BACKING_ID),
        constraint FK_VPX_VDEVICE_BACKING_REL foreign key(VM_ID)
            references VPX_VM(ID) ON DELETE cascade
);

CREATE INDEX VPX_VDEVICE_BACKING_REL_F1 ON VPX_VDEVICE_BACKING_REL(VM_ID);

/*
 * Aggressive autovacuum for VPX_VDEVICE_BACKING_REL to reduce fragmentation
 * caused by huge amount of updates.
 */
ALTER TABLE VPX_VDEVICE_BACKING_REL SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET
 (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET
 (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET
 (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET
 (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_VDEVICE_BACKING_REL SET
 (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_VDEVICE_FILE_BACKING                              */
/*==============================================================*/
CREATE TABLE VPX_VDEVICE_FILE_BACKING (
        BACKING_ID                        INT NOT NULL,
        DATASTORE_ID                      BIGINT,
        HARD_DEVICE_BACKING_FILE_NAME     VARCHAR(2000),
        FILE_BACKING_CONTENT_ID           VARCHAR(255),
        FILE_BACKING_PARENT_ID            INT,
        VM_ID                             BIGINT NOT NULL,
        UPDATE_KEY                        INT,
        DEVICE_BACKING_LUN_UUID           VARCHAR(255),
        DELTA_DISK_FORMAT                 VARCHAR(50),
        SECTOR_FORMAT                     VARCHAR(50),
        constraint PK_VDEVICE_FILE_BACKING primary key (BACKING_ID),
        constraint FK_VDEVICE_FILE_BACKING foreign key(BACKING_ID)
            references VPX_VDEVICE_BACKING_REL (BACKING_ID) on delete cascade
)
;

CREATE INDEX VPX_VDEVICE_FILE_BACKING_U1 ON VPX_VDEVICE_FILE_BACKING(VM_ID, HARD_DEVICE_BACKING_FILE_NAME);
CREATE INDEX VPX_VDEVICE_FILE_BACKING_M1 ON VPX_VDEVICE_FILE_BACKING(HARD_DEVICE_BACKING_FILE_NAME);
CREATE INDEX VPX_VDEVICE_FILE_BACKING_F1 ON VPX_VDEVICE_FILE_BACKING(FILE_BACKING_PARENT_ID);

/*==============================================================*/
/* Index: IX_VPX_VDFB_VM_ID_UPDATE_KEY                          */
/*==============================================================*/
CREATE INDEX IX_VPX_VDFB_VM_ID_UPDATE_KEY ON VPX_VDEVICE_FILE_BACKING (VM_ID, UPDATE_KEY)
;

CREATE INDEX VPX_VDEVICE_FILE_BACKING_M2 ON VPX_VDEVICE_FILE_BACKING(DEVICE_BACKING_LUN_UUID);

/*
 * Aggressive autovacuum for VPX_VDEVICE_FILE_BACKING to reduce fragmentation
 * caused by huge amount of updates.
 */
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET
 (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET
 (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET
 (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET
 (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET
 (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_VDEVICE_FILE_BACKING SET
 (toast.autovacuum_vacuum_cost_limit = 1000);

/*==============================================================*/
/* Table: VPX_VIRTUAL_DISK_IOFILTERS                            */
/*==============================================================*/
CREATE TABLE VPX_VIRTUAL_DISK_IOFILTERS (
  VM_ID BIGINT NOT NULL,
  DISK_KEY INT NOT NULL,
  IOFILTER VARCHAR(128) NOT NULL,
  constraint PK_VPX_VDISK_IOFILTER primary key (VM_ID, DISK_KEY, IOFILTER),
  constraint FK_VPX_VDISK_IOFILTER foreign key(VM_ID)
            references VPX_VM(ID) on delete cascade
)
;

CREATE INDEX IDX_VDISKIOF_IOFILTER ON VPX_VIRTUAL_DISK_IOFILTERS(IOFILTER);

/*==============================================================*/
/* Table: VPX_INT_ARRAY                                         */
/*==============================================================*/
CREATE TABLE VPX_INT_ARRAY (
    ARRAY_ID int NOT NULL,
    TYPE_ID int,
    VALUE int,
    ARRAY_INDEX int,
    MO_TYPE VARCHAR(255),
    MO_ID BIGINT,
    SURR_KEY    SERIAL,
    constraint PK_VPX_INT_ARRAY primary key (ARRAY_ID,SURR_KEY)
);

CREATE INDEX VPX_INT_ARRAY_F2 ON VPX_INT_ARRAY(TYPE_ID);
CREATE INDEX VPX_INT_ARRAY_M1 ON VPX_INT_ARRAY(MO_TYPE, MO_ID);

/*==============================================================*/
/* Table: VPX_STRING_ARRAY                                      */
/*==============================================================*/
CREATE TABLE VPX_STRING_ARRAY (
    ARRAY_ID int NOT NULL,
    TYPE_ID int,
    VALUE VARCHAR(255),
    ARRAY_INDEX int,
    MO_TYPE VARCHAR(255),
    MO_ID BIGINT,
    SURR_KEY    SERIAL,
    constraint PK_VPX_STRING_ARRAY primary key (ARRAY_ID,SURR_KEY)
);

CREATE INDEX VPX_STRING_ARRAY_F1 ON VPX_STRING_ARRAY(TYPE_ID);
CREATE INDEX VPX_STRING_ARRAY_M1 ON VPX_STRING_ARRAY(ARRAY_ID, TYPE_ID,VALUE);
CREATE INDEX VPX_STRING_ARRAY_M2 ON VPX_STRING_ARRAY(MO_TYPE, MO_ID);

/*==============================================================*/
/* Table: VPX_TEXT_ARRAY                                        */
/*==============================================================*/
CREATE TABLE VPX_TEXT_ARRAY (
    ARRAY_ID int NOT NULL,
    TYPE_ID int,
    VALUE TEXT,
    MO_TYPE VARCHAR(255),
    MO_ID BIGINT,
    SURR_KEY    SERIAL,
    constraint PK_VPX_TEXT_ARRAY primary key (ARRAY_ID,SURR_KEY)
);

CREATE INDEX VPX_TEXT_ARRAY_F2 ON VPX_TEXT_ARRAY(TYPE_ID);
CREATE INDEX VPX_TEXT_ARRAY_M1 ON VPX_TEXT_ARRAY(MO_TYPE, MO_ID);

/*==============================================================*/
/* Table: VPX_TYPE_MAP                                          */
/*==============================================================*/
CREATE TABLE VPX_TYPE_MAP (
    TYPE_NAME VARCHAR(255) NOT NULL,
    ARRAY_NUM int NOT NULL,
    MO_REF VARCHAR(255),
    CONSTRAINT PK_VPX_TYPE_MAP PRIMARY KEY (TYPE_NAME, ARRAY_NUM)
);


/*==============================================================*/
/* Table: VPX_HOST_SCSI_DISK_PARTITION                          */
/*==============================================================*/
CREATE TABLE VPX_HOST_SCSI_DISK_PARTITION (
        ID         INT NOT NULL,
        HOST_ID    BIGINT NOT NULL,
        VMFS_UUID  VARCHAR(128),
        DISK_NAME  VARCHAR(512),
        constraint FK_HOST_SCSI_DISK_PART foreign key(HOST_ID)
                   references VPX_HOST (ID) on delete cascade
)
;
CREATE INDEX VPX_SCSI_DISKPART_F1 on VPX_HOST_SCSI_DISK_PARTITION(HOST_ID);
CREATE INDEX VPX_SCSI_DISKPART_F2 on VPX_HOST_SCSI_DISK_PARTITION(ID);
CREATE INDEX VPX_SCSI_DISKPART_F3 on VPX_HOST_SCSI_DISK_PARTITION(VMFS_UUID);


/*==============================================================*/
/* Table: VPX_CALLBACK_SERVICE                                  */
/*==============================================================*/
CREATE TABLE VPX_CALLBACK_SERVICE (
        ID    INT NOT NULL,
        WSDL_NAME    VARCHAR(50),
        URL_STRING    VARCHAR(255),
        constraint PK_VPX_CALLBACK_SERVICE primary key (ID)
);

/*==============================================================*/
/* Index: VPXI_CBK_SERV_UNIQUE_KEY                              */
/*==============================================================*/
create unique index VPXI_CBK_SERV_UNIQUE_KEY on VPX_CALLBACK_SERVICE (
   WSDL_NAME,
   URL_STRING
);

/*==============================================================*/
/* Table: VPX_CALLBACK_WHITELIST                                */
/*==============================================================*/
CREATE TABLE VPX_CALLBACK_WHITELIST (
        SERV_ID    INT NOT NULL,
        MOID       VARCHAR(127),
        constraint PK_VPX_CBK_WL primary key (SERV_ID, MOID),
        constraint FK_WL_REF_VPX_CBK_SERV foreign key(SERV_ID)
        references VPX_CALLBACK_SERVICE (ID) on delete cascade
);


/*==============================================================*/
/* Table: VPX_HOST_SCSI_LUN                                     */
/*==============================================================*/
CREATE TABLE VPX_HOST_SCSI_LUN (
        ID                       INT NOT NULL,
        HOST_ID                  BIGINT NOT NULL,
        UUID                     VARCHAR(255) NOT NULL,
        CANONICAL_NAME           VARCHAR(255),
        DISPLAY_NAME             VARCHAR(255),
        UPDATE_DISPLAY_NAME_FLG  NUMERIC(1),
        constraint PK_VPX_HOST_SCSI_LUN primary key (ID),
        constraint FK_HOST_SCSI_LUN_VPX_HOST foreign key(HOST_ID)
                   references VPX_HOST (ID) on delete cascade
)
;
create index VPX_HOST_SCSI_LUN_F1 on VPX_HOST_SCSI_LUN(HOST_ID);


/*==============================================================*/
/* Table: VPX_HOST_TEXT                                         */
/*==============================================================*/
CREATE TABLE VPX_HOST_TEXT (
   ID        BIGINT NOT NULL,
   TYPE_ID   INT NOT NULL,
   VALUE     TEXT,
   constraint PK_HOST_TEXT primary key (ID, TYPE_ID),
   constraint FK_HOST_TEXT_HOST foreign key(ID) references VPX_HOST (ID) on delete cascade
)
;


/*==============================================================*/
/* Table: VPX_HOST_TPM_ATTESTATION                              */
/*==============================================================*/
CREATE TABLE VPX_HOST_TPM_ATTESTATION (
   HOST_ID               BIGINT    NOT NULL,
   ATTESTATION_TIME      TIMESTAMP NOT NULL,
   ATTESTATION_STATUS    INTEGER   NOT NULL,
   ATTESTATION_MESSAGE   TEXT      NULL,
   constraint PK_HOST_TPM_ATTESTATION primary key (HOST_ID),
   constraint FK_HOST_TPM_ATTESTATION_HOST foreign key(HOST_ID)
              references VPX_HOST (ID) on delete cascade
)
;


/*==============================================================*/
/* Table: VPX_DS_INFO                                           */
/*==============================================================*/
CREATE TABLE VPX_DS_INFO (
   ID                            BIGINT         NOT NULL,
   FREE_SPACE                    VARCHAR(21)    NULL,
   MAX_FILE_SIZE                 VARCHAR(21)    NULL,
   MAX_MEMORY_FILE_SIZE          NUMERIC(22)    DEFAULT 70368744177664 NOT NULL,
   NAME                          VARCHAR(255)   NULL,
   TIMESTAMP                     TIMESTAMP,
   URL                           VARCHAR(440)   NOT NULL,
   VPX_TYPE                      VARCHAR(255)   NULL,
   PATH                          VARCHAR(512)   NULL,
   REMOTE_HOST                   VARCHAR(255)   NULL,
   REMOTE_HOST_NAMES             TEXT           NULL,
   REMOTE_PATH                   VARCHAR(512)   NULL,
   USER_NAME                     VARCHAR(255)   NULL,
   SECURITY_TYPE                 VARCHAR(512)   NULL,
   BLOCKSIZE_MB                  INT            NULL,
   FORCEMOUNT_FLG                NUMERIC(1)     NULL,
   FORCEMOUNT_PERSIST_FLG        NUMERIC(1)     NULL,
   MAJOR_VERSION                 INT            NULL,
   MAX_PHYSICAL_RDM_FILE_SIZE    NUMERIC(22)    NULL,
   MAX_VIRTUAL_RDM_FILE_SIZE     NUMERIC(22)    NULL,
   VMFS_UUID                     VARCHAR(255)   NULL,
   VMFS_VERSION                  VARCHAR(255)   NULL,
   VMFS_UPGRADEABLE              NUMERIC(1)     NULL,
   VMFS_NAME                     VARCHAR(255)   NULL,
   VMFS_TYPE                     VARCHAR(255)   NULL,
   VMFS_CAPACITY                 NUMERIC(38)    NULL,
   VMFS_MAX_BLOCKS               INT            NULL,
   VMFS_SSD_FLG                  NUMERIC(1)     NULL,
   VVOL_UUID                     VARCHAR(255)   NULL,
   VVOL_VASA_PROVIDER_INFO       TEXT           NULL,
   VVOL_STORAGE_ARRAY            TEXT           NULL,
   constraint PK_VPX_DS_INFO primary key (ID,URL),
   constraint FK_VPX_DS_INFO foreign key (ID)
      references VPX_DATASTORE (ID) on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_DS_VMFS_EXTENT                                    */
/*==============================================================*/
CREATE TABLE VPX_DS_VMFS_EXTENT (
   ID              BIGINT         NOT NULL,
   DISK_NAME       VARCHAR(512),
   PARTITION_VAL   INT,
   SURR_KEY        SERIAL,
   constraint PK_VPX_DS_VMFS_EXTENT primary key (ID,SURR_KEY),
   constraint FK_VPX_DS_VMFS_EXTENT_REF_DS foreign key(ID)
       references VPX_DATASTORE (ID) on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_NORM_VM_FLE_FILE_INFO                             */
/*==============================================================*/
CREATE TABLE VPX_NORM_VM_FLE_FILE_INFO (
        VM_ID      BIGINT NOT NULL,
        KEY_VAL    INT NOT NULL,
        NAME       VARCHAR(420) DEFAULT ' ',
        FILE_SIZE  VARCHAR(22),
        FILE_UNIQUESIZE VARCHAR(22),
        TYPE       VARCHAR(255),
        constraint PK_NFLE_FILE_INFO primary key (VM_ID, KEY_VAL),
        constraint FK_NFLE_FILE_INFO_REF_VM foreign key(VM_ID)
           references VPX_VM (ID) on delete cascade
)
;

CREATE INDEX VPX_NFLE_FILE_INFO_M1 on VPX_NORM_VM_FLE_FILE_INFO(NAME);

/*==============================================================*/
/* Table: VPX_VM_VIRTUAL_DEVICE                                 */
/*==============================================================*/
CREATE TABLE VPX_VM_VIRTUAL_DEVICE (
        ID                              BIGINT NOT NULL,
        CONN_AL_GU_CONTROL_FLAG         NUMERIC(1),
        CONN_CONNECTED_FLAG             NUMERIC(1),
        CONN_START_CONNECTED_FLAG       NUMERIC(1),
        CONN_STATUS                     VARCHAR(255),
        DEVICE_INFO_SUMMARY             VARCHAR(255),
        DEVICE_INFO_LABEL               VARCHAR(255),
        DEVICE_CONTROLLER_KEY           INT,
        DEVICE_UNIT_NUMBER              INT,
        DEVICE_KEY                      INT NOT NULL,
        DEVICE_TYPE                     VARCHAR(255),
        DEVICE_TEXT                     TEXT,
        constraint PK_VPX_VM_VIRTUAL_DEVICE primary key (ID, DEVICE_KEY),
        constraint FK_VPX_VM_VIRTUAL_DEVICE foreign key(ID)
            references VPX_VM(ID) on delete cascade
)
;

/*
 * Aggressive autovacuum for VPX_VM_VIRTUAL_DEVICE to reduce fragmentation
 * caused by huge amount of updates.
 */
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (toast.autovacuum_vacuum_scale_factor = 0.05);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (autovacuum_analyze_scale_factor = 0.05);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (toast.autovacuum_vacuum_threshold = 25);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (autovacuum_analyze_threshold = 25);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (toast.autovacuum_vacuum_cost_delay = 10);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (autovacuum_vacuum_cost_limit = 1000);
ALTER TABLE VPX_VM_VIRTUAL_DEVICE SET (toast.autovacuum_vacuum_cost_limit = 1000);


/*==============================================================*/
/* Table: VPX_SN_VDEVICE_BACKING_REL                            */
/*==============================================================*/
CREATE TABLE VPX_SN_VDEVICE_BACKING_REL (
        BACKING_ID      INT NOT NULL,
        VPX_TYPE        VARCHAR(255),
        SN_ID           BIGINT NOT NULL,
        UPDATE_KEY      INT,
        constraint PK_SN_VPX_VDEVICE_BACKING_REL primary key (BACKING_ID),
        constraint FK_SN_VPX_VDEVICE_BACKING_REL foreign key(SN_ID)
            references VPX_SNAPSHOT (ID) ON DELETE cascade
);

CREATE INDEX IDX_SN_VDEVICE_BACKING_REL ON VPX_SN_VDEVICE_BACKING_REL(SN_ID);

/*==============================================================*/
/* Table: VPX_SN_VDEVICE_FILE_BACKING                           */
/*==============================================================*/
CREATE TABLE VPX_SN_VDEVICE_FILE_BACKING (
        BACKING_ID                        INT NOT NULL,
        DATASTORE_ID                      BIGINT,
        HARD_DEVICE_BACKING_FILE_NAME     VARCHAR(2000),
        FILE_BACKING_CONTENT_ID           VARCHAR(255),
        FILE_BACKING_PARENT_ID            INT,
        SNAPSHOT_ID                       BIGINT NOT NULL,
        UPDATE_KEY                        INT,
        DEVICE_BACKING_LUN_UUID           VARCHAR(255),
        DELTA_DISK_FORMAT                 VARCHAR(50),
        SECTOR_FORMAT                     VARCHAR(50),
        constraint PK_SN_VDEVICE_FILE_BACKING primary key (BACKING_ID),
        constraint FK_SN_VDEVICE_FILE_BACKING foreign key(BACKING_ID)
            references VPX_SN_VDEVICE_BACKING_REL (BACKING_ID) on delete cascade
)
;
CREATE INDEX VPX_SN_VDEVICE_FILE_BACKING_U1 ON VPX_SN_VDEVICE_FILE_BACKING(SNAPSHOT_ID, HARD_DEVICE_BACKING_FILE_NAME);
CREATE INDEX VPX_SN_VDEVICE_FILE_BACKING_M1 ON VPX_SN_VDEVICE_FILE_BACKING(HARD_DEVICE_BACKING_FILE_NAME);
CREATE INDEX VPX_SN_VDEVICE_FILE_BACKING_F1 ON VPX_SN_VDEVICE_FILE_BACKING(FILE_BACKING_PARENT_ID);
CREATE INDEX VPX_SN_VDEVICE_FILE_BACKING_M2 ON VPX_SN_VDEVICE_FILE_BACKING(DEVICE_BACKING_LUN_UUID);

/*==============================================================*/
/* Table: VPX_VM_SN_VIRTUAL_DEVICE                              */
/*==============================================================*/
CREATE TABLE VPX_VM_SN_VIRTUAL_DEVICE (
        ID                              BIGINT NOT NULL,
        CONN_AL_GU_CONTROL_FLAG         NUMERIC(1),
        CONN_CONNECTED_FLAG             NUMERIC(1),
        CONN_START_CONNECTED_FLAG       NUMERIC(1),
        CONN_STATUS                     VARCHAR(255),
        DEVICE_INFO_SUMMARY             VARCHAR(255),
        DEVICE_INFO_LABEL               VARCHAR(255),
        DEVICE_CONTROLLER_KEY           INT,
        DEVICE_UNIT_NUMBER              INT,
        DEVICE_KEY                      INT NOT NULL,
        DEVICE_TYPE                     VARCHAR(255),
        DEVICE_TEXT                     TEXT,
        constraint PK_VPX_VM_SN_VIRTUAL_DEVICE primary key (ID, DEVICE_KEY),
        constraint FK_VPX_VM_SN_VIRTUAL_DEVICE foreign key(ID)
            references VPX_SNAPSHOT (ID) on delete cascade
)
;


/*==============================================================*/
/* Table: VPX_HOST_SCSILUN_DESCRIPTOR                           */
/*==============================================================*/
CREATE TABLE VPX_HOST_SCSILUN_DESCRIPTOR (
        ID                 INT NOT NULL,
        DESCRIPTOR_ID_VAL  VARCHAR(255),
        QUALITY            VARCHAR(255),
        constraint FK_HOST_SCSILUN_DESCRIPTOR foreign key(ID)
                   references VPX_HOST_SCSI_LUN (ID) on delete cascade
)
;

CREATE INDEX VPX_HOST_SCSILUN_DESC_HOST on VPX_HOST_SCSILUN_DESCRIPTOR(ID);

/*==============================================================*/
/* Table: VPX_USAGE_STAT                                        */
/*==============================================================*/
CREATE TABLE VPX_USAGE_STAT(
 COUNTER_ID  INT  NOT NULL,
 TIME_ID     INT  NOT NULL,
 STAT_VAL    NUMERIC(38)  NOT NULL,
  constraint PK_VPX_USAGE_STAT primary key  (COUNTER_ID,TIME_ID)
);

/*==============================================================*/
/* Table: VPX_USAGE_SAMPLE_TIME                                 */
/*==============================================================*/
create table VPX_USAGE_SAMPLE_TIME (
TIME_ID INT NOT NULL,
SAMPLE_TIME TIMESTAMP,
SAMPLE_INTERVAL NUMERIC(10),
CONSTRAINT PK_VPX_USAGE_SAMPLE_TIME PRIMARY KEY (TIME_ID)
);


/*==============================================================*/
/* Index: VPX_USAGE_SAMPLE_TIME_U1                              */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_USAGE_SAMPLE_TIME_U1 ON VPX_USAGE_SAMPLE_TIME(SAMPLE_TIME, SAMPLE_INTERVAL);

/*==============================================================*/
/* Table: VPX_TAG                                               */
/*==============================================================*/
create table VPX_TAG (
    TAG_ID INT NOT NULL,
    NAME   VARCHAR(255) NOT NULL,
    TYPE_ID INT NOT NULL,
    constraint PK_VPX_TAG primary key (TAG_ID)
);

/*==============================================================*/
/* Index: VPX_TAG_U1                                            */
/*==============================================================*/
CREATE UNIQUE INDEX VPX_TAG_U1 ON VPX_TAG(NAME, TYPE_ID);

/*==============================================================*/
/* Table: VPX_TAG_ENT_ASSOCIATION                               */
/*==============================================================*/
create table VPX_TAG_ENT_ASSOCIATION (
    TAG_ID      INT         NOT NULL,
    ENTITY_ID   BIGINT      NOT NULL,
    constraint PK_VPX_TAG_ENT_ASSOCIATION primary key (TAG_ID, ENTITY_ID),
    constraint FK_TAG_ENT_ASSOCIATION1 foreign key (TAG_ID)
        references VPX_TAG (TAG_ID),
    constraint FK_TAG_ENT_ASSOCIATION2 foreign key (ENTITY_ID)
        references VPX_ENTITY (ID) on delete cascade
);

/*==============================================================*/
/* Table: VPX_ENTITY_VMOP_COUNT                                 */
/*==============================================================*/
create table VPX_ENTITY_VMOP_COUNT (
   ID                   BIGINT               NOT  NULL,
   POWERON_COUNT        int                  null,
   POWEROFF_COUNT       int                  null,
   SUSPEND_COUNT        int                  null,
   RESET_COUNT          int                  null,
   REBOOTGUEST_COUNT    int                  null,
   STANDBYGUEST_COUNT   int                  null,
   SHUTDOWNGUEST_COUNT  int                  null,
   CREATE_COUNT         int                  null,
   DESTROY_COUNT        int                  null,
   REGISTER_COUNT       int                  null,
   UNREGISTER_COUNT     int                  null,
   RECONFIGURE_COUNT    int                  null,
   CLONE_COUNT          int                  null,
   DEPLOY_COUNT         int                  null,
   CHANGEHOST_COUNT     int                  null,
   CHANGEDS_COUNT       int                  null,
   CHANGEHOSTDS_COUNT   int                  null,
   VMOTION_COUNT        int                  null,
   SVMOTION_COUNT       int                  null,
   XVMOTION_COUNT       int                  null,
   constraint PK_VPX_ENTITY_VMOP_COUNT primary key  (ID),
   constraint FK_VPX_ENTITY_VMOP_COUNT_REF foreign key (ID)
         references VPX_ENTITY (ID)
         on delete cascade
)
;

/*==============================================================*/
/* Table: VPX_BINARY_DATA                                       */
/*==============================================================*/
create table VPX_BINARY_DATA (
   ID                   int                 NOT NULL,
   DATA_TYPE            VARCHAR(255)      NOT NULL,
   BIN_DATA             BYTEA               NOT NULL,
   CREATED_TIME         TIMESTAMP WITH TIME ZONE  NOT NULL,
   CHANGE_ID            VARCHAR(255)      ,
   constraint PK_VPX_BIN_DATA primary key (ID)
)
;

/*==============================================================*/
/* Table: VPX_DVHOST_OUT_OF_SYNC                                */
/*==============================================================*/
create table VPX_DVHOST_OUT_OF_SYNC (
    DVS_ID                   BIGINT                  not null,
    HOST_ID                  BIGINT                  not null,
    PROPERTY_NAME            VARCHAR(255)         not null,
    constraint PK_DVHOST_OUT_OF_SYNC primary key (DVS_ID,HOST_ID,PROPERTY_NAME),
    constraint FK_DVHOST_OUT_OF_SYNC_REF_ENTI foreign key (DVS_ID)
        references VPX_DVS (ID)
    on delete cascade
    );

/*==============================================================*/
/* Table: VPX_VAPP_LINK                                         */
/*==============================================================*/
create table VPX_VAPP_LINK  (
   CHILD_ENTITY_ID          BIGINT     not null,
   PARENT_VAPP_ID           BIGINT     not null,
   DESTROY_WITH_PARENT      NUMERIC(1)   default 0 not null,
   constraint PK_VPX_VAPP_LINK primary key (CHILD_ENTITY_ID)
);

CREATE INDEX VPXI_VAPP_LINK_PARENT_VAPP_ID ON VPX_VAPP_LINK(PARENT_VAPP_ID);

/*==============================================================*/
/* Table: VPX_PRODUCT                                           */
/*==============================================================*/

CREATE TABLE VPX_PRODUCT(
   PRODUCT_ID    INTEGER NOT  NULL,
   PRODUCT_DESC  VARCHAR(255),
   constraint PK_PRODUCT primary key  (PRODUCT_ID)
);

/*==============================================================*/
/* Add indexes/comments for table VPX_PRODUCT                   */
/*==============================================================*/

COMMENT ON COLUMN VPX_PRODUCT.PRODUCT_ID IS 'Product id of the application';
COMMENT ON COLUMN VPX_PRODUCT.PRODUCT_DESC IS 'Product description';

/*==============================================================*/
/* Table: VPX_TERMINATION_REASON                                */
/*==============================================================*/

CREATE TABLE VPX_TERMINATION_REASON(
   TERMINATION_ID    INTEGER NOT  NULL,
   TERMINATION_DESC  VARCHAR(255),
   constraint PK_TERMINATION_REASON primary key  (TERMINATION_ID)
);

/*==============================================================*/
/* Add indexes/comments for table VPX_TERMINATION_REASON        */
/*==============================================================*/

COMMENT ON COLUMN VPX_TERMINATION_REASON.TERMINATION_ID IS 'Termination id of the application';
COMMENT ON COLUMN VPX_TERMINATION_REASON.TERMINATION_DESC IS 'Termination description';

/*==============================================================*/
/* Table: VPX_UPTIME                                            */
/*==============================================================*/

CREATE TABLE VPX_UPTIME(
   START_TIME  TIMESTAMP,
   END_TIME    TIMESTAMP,
   HOST_NAME   VARCHAR(255),
   HOST_UUID   VARCHAR(255),
   BUILD_NUM   VARCHAR(255),
   PROD_ID     INTEGER NOT NULL,
   TERM_ID     INTEGER NOT NULL,
   SURR_KEY    SERIAL,
   constraint PK_VPX_UPTIME primary key (PROD_ID,TERM_ID,SURR_KEY),
   constraint FK_VPX_UPTIME_PRODID FOREIGN KEY (PROD_ID)
         references VPX_PRODUCT (PRODUCT_ID),
   constraint FK_VPX_UPTIME_TERMID FOREIGN KEY (TERM_ID)
         references VPX_TERMINATION_REASON (TERMINATION_ID)
);

/*==============================================================*/
/* Add indexes/comments for table VPX_UPTIME                    */
/*==============================================================*/

COMMENT ON COLUMN VPX_UPTIME.START_TIME IS 'Application start time';
COMMENT ON COLUMN VPX_UPTIME.END_TIME IS 'Application termination time';
COMMENT ON COLUMN VPX_UPTIME.HOST_NAME IS 'Host name where appl runs';
COMMENT ON COLUMN VPX_UPTIME.HOST_UUID IS 'UUID of Host where appl runs';
COMMENT ON COLUMN VPX_UPTIME.BUILD_NUM IS 'Build # of the application';
COMMENT ON COLUMN VPX_UPTIME.PROD_ID IS 'Product id of the application';
COMMENT ON COLUMN VPX_UPTIME.TERM_ID IS 'Termination reason for the run';

/*==============================================================*/
/* Table: VPX_SDRS_POD_CONFIG                                   */
/*==============================================================*/

CREATE TABLE VPX_SDRS_POD_CONFIG(
   POD_ID      BIGINT           NOT NULL,
   CONFIG_XML  TEXT             NOT NULL,
   constraint PK_VPX_SDRS_POD_CONFIG primary key (POD_ID),
   constraint FK_VPX_SDRS_POD_CONFIG foreign key (POD_ID)
      references VPX_ENTITY (ID)
         on delete cascade
);

/*==============================================================*/
/* Table: VPX_TABLE                                             */
/*==============================================================*/
CREATE TABLE VPX_TABLE
(TABLE_NAME   VARCHAR(30) NOT NULL,
 COL_NAME     VARCHAR(30) NOT NULL,
 COL_TYPE     INTEGER NOT NULL,
 COL_LEN      INTEGER NOT NULL,
 PK_FLG       INTEGER DEFAULT 0 NOT NULL,
 CONSTRAINT PK_VPX_TABLE PRIMARY KEY (TABLE_NAME, COL_NAME)
);

/*==============================================================*/
/* Table: VPX_INDEX_COLUMN                                      */
/*==============================================================*/
CREATE TABLE VPX_INDEX_COLUMN
(TABLE_NAME   VARCHAR(30) NOT NULL,
 INDEX_NAME   VARCHAR(30) NOT NULL,
 COL_NAME     VARCHAR(30) NOT NULL,
 CONSTRAINT PK_VPX_INDEX_COLUMN PRIMARY KEY (TABLE_NAME, INDEX_NAME, COL_NAME)
);

/*==============================================================*/
/* Table: VPX_SDRS_STATS_VM                                     */
/*==============================================================*/

CREATE TABLE VPX_SDRS_STATS_VM(
   VM_ID       BIGINT   NOT NULL,   /* identifies VM */
   QUANTILES   TEXT,               /* serialized blob of quantiles */
   HISTORY     TEXT,               /* serialized blob of history */
   SPACE_STATS TEXT,               /* serialized blob of space stats */
   constraint PK_VPX_SDRS_STATS_VM primary key (VM_ID)
);

/*==============================================================*/
/* Table: VPX_SDRS_STATS_DATASTORE                              */
/*==============================================================*/

CREATE TABLE VPX_SDRS_STATS_DATASTORE(
   UUID        VARCHAR(64) NOT NULL,   /* datastore uuid */
   QUANTILES   TEXT,                   /* serialized blob of quantiles */
   HISTORY     TEXT,                   /* serialized blob of history */
   INJECTOR    TEXT,                   /* serialized blob of injector data */
   constraint PK_VPX_STATS_DS primary key (UUID)
);

/*==============================================================*/
/* Table: VPX_SCHEMA_HASH                                       */
/*==============================================================*/

CREATE TABLE VPX_SCHEMA_HASH(
   SCHEMA_HASH  VARCHAR(50), /* hash of VCDB_PostgreSQL.sql */
   BUILD_NUM	VARCHAR(30) /* VC build number when the schema hash is updated */
);

/*===============================================================*/
/* View Log on VPX_DEVICE                                        */
/*===============================================================*/

/*===============================================================*/
/* View Log on VPX_STAT_COUNTER                                  */
/*===============================================================*/

/*==============================================================*/
/* Table: VPX_LIC_TPS_ASSETS                                    */
/*==============================================================*/

CREATE TABLE VPX_LIC_TPS_ASSETS(
 ASSET_ID Integer NOT NULL,
 ASSET_NAME VARCHAR(64) NOT NULL,
 DESCRIPTION VARCHAR(255)
)
;

COMMENT ON TABLE VPX_LIC_TPS_ASSETS IS '3rd party solutions assets'
;
COMMENT ON COLUMN VPX_LIC_TPS_ASSETS.ASSET_ID IS 'Numeric ID, assigned by VMware'
;
COMMENT ON COLUMN VPX_LIC_TPS_ASSETS.ASSET_NAME IS 'Textual ID, assigned by VMware'
;
COMMENT ON COLUMN VPX_LIC_TPS_ASSETS.DESCRIPTION IS 'Asset description for user interfaces'
;

/*==============================================================*/
/* Add keys for table VPX_LIC_TPS_ASSETS                        */
/*==============================================================*/

ALTER TABLE VPX_LIC_TPS_ASSETS ADD CONSTRAINT PK_VPX_LIC_TPS_ASSETS PRIMARY KEY (ASSET_ID)
;
ALTER TABLE VPX_LIC_TPS_ASSETS ADD CONSTRAINT UK_VPX_LIC_TPS_ASSETS UNIQUE (ASSET_NAME)
;

/*==============================================================*/
/* Table: VPX_LIC_AUTO_KEYS                                     */
/*==============================================================*/

CREATE TABLE VPX_LIC_AUTO_KEYS(
 ENTITY_ID BIGINT NOT NULL,
 ASSET_ID Integer NOT NULL,
 LICENSE TEXT NOT NULL
)
;

COMMENT ON TABLE VPX_LIC_AUTO_KEYS IS 'Auto-assignment license keys configuration'
;
COMMENT ON COLUMN VPX_LIC_AUTO_KEYS.ENTITY_ID IS 'vCenter managed entity to associate key with'
;
COMMENT ON COLUMN VPX_LIC_AUTO_KEYS.ASSET_ID IS '3rd party solution to assign key to'
;
COMMENT ON COLUMN VPX_LIC_AUTO_KEYS.LICENSE IS '3rd party license key'
;

/*==============================================================*/
/* Add keys for table VPX_LIC_AUTO_KEYS                         */
/*==============================================================*/

ALTER TABLE VPX_LIC_AUTO_KEYS ADD CONSTRAINT PK_VPX_LIC_AUTO_KEYS PRIMARY KEY (ENTITY_ID, ASSET_ID)
;
ALTER TABLE VPX_LIC_AUTO_KEYS ADD CONSTRAINT FK_VPX_LIC_AUTO_KEYS_ENTITY_ID FOREIGN KEY (ENTITY_ID) REFERENCES VPX_ENTITY (ID) ON DELETE CASCADE
;
ALTER TABLE VPX_LIC_AUTO_KEYS ADD CONSTRAINT FK_VPX_LIC_AUTO_KEYS_ASSET_ID FOREIGN KEY (ASSET_ID) REFERENCES VPX_LIC_TPS_ASSETS (ASSET_ID)
;

/*==============================================================*/
/* Create indexes for table VPX_LIC_AUTO_KEYS                   */
/*==============================================================*/

CREATE INDEX VPXI_LIC_AUTO_KEYS_ASSET_ID on VPX_LIC_AUTO_KEYS (ASSET_ID)
;

/*==============================================================*/
/* Table: VPX_DBM_COUNTER_METADATA                              */
/*==============================================================*/

CREATE TABLE VPX_DBM_COUNTER_METADATA(
  COUNTER_ID Integer NOT NULL,
  NAME VARCHAR(100) NOT NULL,
  OBJECT_NAME VARCHAR(100) NOT NULL,
  UNIT VARCHAR(30 ) NOT NULL,
  KEEP_DAYS Integer NOT NULL,
  DESCRIPTION VARCHAR(1000) NOT NULL,
  SOLUTION VARCHAR(1000) NOT NULL,
  SQL_STATEMENT VARCHAR(4000 ) NOT NULL,
  RANGE_TYPE VARCHAR(30 ) NOT NULL
        CONSTRAINT ck_counter_range_type CHECK (RANGE_TYPE IN ('range', 'boolean')),
  RANGE_MIN NUMERIC(22),
  RANGE_MAX NUMERIC(22)
)
;

COMMENT ON TABLE VPX_DBM_COUNTER_METADATA IS 'Database Health Monitor - Performance counters metadata'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.COUNTER_ID IS 'Unique identifier of performance counter'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.NAME IS 'Name of performance counter '
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.OBJECT_NAME IS 'Name of performance object '
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.UNIT IS 'Unit of measurment'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.KEEP_DAYS IS 'Retention period - number of days to keep history of gathered counter values'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.DESCRIPTION IS 'Description of performance counter '
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.SOLUTION IS 'Message/recommendation for users when counter value is out of range'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.SQL_STATEMENT IS 'Sql query to be executed by the engine to collect value for the counter '
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.RANGE_TYPE IS 'Type of range of acceptable counter values'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.RANGE_MIN IS 'Minimal acceptable range value (Null is represention of negative infinity)'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_METADATA.RANGE_MAX IS 'Maximal acceptable range value (Null is represention of possitive infinity)'
;

/*==============================================================*/
/* Add keys for table VPX_DBM_COUNTER_METADATA                  */
/*==============================================================*/

ALTER TABLE VPX_DBM_COUNTER_METADATA ADD CONSTRAINT PK_VPX_DBM_COUNTER_METADATA PRIMARY KEY (COUNTER_ID)
;

/*==============================================================*/
/* Table: VPX_DBM_COUNTER_VALUE                                 */
/*==============================================================*/

CREATE TABLE VPX_DBM_COUNTER_VALUE(
  COUNTER_ID Integer NOT NULL,
  SAMPLE_TIME Timestamp(3) DEFAULT now() NOT NULL,
  COUNTER_VALUE NUMERIC(22)
)
;

COMMENT ON TABLE VPX_DBM_COUNTER_VALUE IS 'Database Health Monitor - Performance counter values'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_VALUE.COUNTER_ID IS 'Unique identifier of performance counter'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_VALUE.SAMPLE_TIME IS 'Counter sample time'
;
COMMENT ON COLUMN VPX_DBM_COUNTER_VALUE.COUNTER_VALUE IS 'Counter value'
;

/*==============================================================*/
/* Add keys for table VPX_DBM_COUNTER_VALUE                     */
/*==============================================================*/

ALTER TABLE VPX_DBM_COUNTER_VALUE ADD CONSTRAINT PK_VPX_DBM_COUNTER_VALUE PRIMARY KEY (COUNTER_ID,SAMPLE_TIME)
;

ALTER TABLE VPX_DBM_COUNTER_VALUE ADD CONSTRAINT FK_VPX_DBM_COUNTER_VALUES FOREIGN KEY (COUNTER_ID) REFERENCES VPX_DBM_COUNTER_METADATA (COUNTER_ID)
;

/*==============================================================*/
/* Table: VPX_CRYPTO_KMIP_CLUSTER                               */
/*==============================================================*/

CREATE TABLE VPX_CRYPTO_KMIP_CLUSTER(
   CLUSTER_ID     VARCHAR(255) NOT NULL,
   USE_AS_DEFAULT INTEGER NOT NULL,
   CONSTRAINT PK_VPX_CRYPTO_KMIP_CLUSTER PRIMARY KEY (CLUSTER_ID)
);

/*==============================================================*/
/* Table: VPX_CRYPTO_SERVER                                     */
/*==============================================================*/

CREATE TABLE VPX_CRYPTO_SERVER(
   CLUSTER_ID     VARCHAR(255) NOT NULL,
   NAME           VARCHAR(255) NOT NULL,
   ADDRESS        VARCHAR(255) NOT NULL,
   PORT           INTEGER,
   PROXY_ADDRESS  VARCHAR(255),
   PROXY_PORT     INTEGER,
   RECONNECT      INTEGER,
   PROTOCOL       VARCHAR(127),
   NBIO           INTEGER,
   TIMEOUT        INTEGER,
   USER_NAME      VARCHAR(255),
   CONSTRAINT PK_VPX_CRYPTO_SERVER PRIMARY KEY (CLUSTER_ID, NAME),
   CONSTRAINT FK_VPX_CRYPTO_KMIP_CLUSTER FOREIGN KEY (CLUSTER_ID)
         REFERENCES VPX_CRYPTO_KMIP_CLUSTER(CLUSTER_ID)
);

/*==============================================================*/
/* Table: VPX_HOST_CRYPTO_KEYS                                  */
/*                                                              */
/* Stores the encryption keys used by the hosts and a count of  */
/* their usage. The encryption keys are identified by a pair of */
/* keyId and keyProviderId. See vim.encryption.CryptoKeyId      */
/*==============================================================*/

CREATE TABLE VPX_HOST_CRYPTO_KEYS(
   HOST_ID                    BIGINT           NOT NULL,
   CRYPTO_KEY_ID              VARCHAR(255)      NOT NULL,
   CRYPTO_KEY_PROVIDER_ID     VARCHAR(255)      NOT NULL,
   USAGE_COUNT                INTEGER,
   CONSTRAINT PK_VPX_HOST_CRYPTO_KEYS PRIMARY KEY (HOST_ID, CRYPTO_KEY_ID, CRYPTO_KEY_PROVIDER_ID),
   CONSTRAINT PK_VPX_HOST_CRYPTO_KEYS_REF FOREIGN KEY (HOST_ID)
      REFERENCES VPX_HOST (ID)
         ON DELETE CASCADE
);

--==============================================================
-- Table: VPX_PROC_LOG
--==============================================================
CREATE TABLE VPX_PROC_LOG
(
   EVENT_ID SERIAL,
   PROC_NAME VARCHAR(50) NOT NULL,
   EVENT VARCHAR(50) NOT NULL,
   EVENT_DT TIMESTAMP DEFAULT TIMEZONE('UTC',now()) NOT NULL,
   ERR_FLAG INTEGER NOT NULL,
   DESCRIPTION VARCHAR(1000),
   CONSTRAINT PK_VPX_PROC_LOG PRIMARY KEY(EVENT_ID)
);

CREATE INDEX VPXI_PROC_LOG_NAME ON VPX_PROC_LOG (PROC_NAME);
/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_CLSTR_CFG                            */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_CLSTR_CFG(
   CLUSTER_ID            BIGINT NOT NULL,
   IS_ENABLED            NUMERIC(1),
   BEHAVIOR              VARCHAR(56),
   MODERATE_REMEDIATION  VARCHAR(56),
   SEVERE_REMEDIATION    VARCHAR(56),
   CONSTRAINT PK_VPX_INFRA_UPD_HA_CLSTR_CFG PRIMARY KEY (CLUSTER_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_CLSTR_CFG FOREIGN KEY (CLUSTER_ID)
      REFERENCES VPX_COMPUTE_RESOURCE(ID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_PROVIDER                             */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_PROVIDER(
   PROVIDER_ID    INTEGER NOT NULL,
   PROVIDER_UUID  CHAR(47),
   PROVIDER_NAME  VARCHAR(56),
   USER_NAME      VARCHAR(255),
   CONSTRAINT PK_VPX_INFRA_UPD_HA_PROVIDER PRIMARY KEY (PROVIDER_ID)
);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_P_H                                  */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_P_H(
   PROVIDER_ID  INTEGER NOT NULL,
   HOST_ID      BIGINT NOT NULL,
   CONSTRAINT PK_VPX_INFRA_UPD_HA_P_H PRIMARY KEY (PROVIDER_ID, HOST_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_P_H_P FOREIGN KEY (PROVIDER_ID)
      REFERENCES VPX_INFRA_UPD_HA_PROVIDER(PROVIDER_ID) ON DELETE CASCADE,
   CONSTRAINT FK_VPX_INFRA_UPD_HA_P_H_H FOREIGN KEY (HOST_ID)
      REFERENCES VPX_HOST(ID) ON DELETE CASCADE
);

CREATE INDEX VPXI_INFRA_UPD_HA_P_H_HOST ON VPX_INFRA_UPD_HA_P_H(HOST_ID);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_CP                                   */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_CP(
   CLUSTER_ID  BIGINT NOT NULL,
   PROVIDER_ID INTEGER NOT NULL,
   CONSTRAINT PK_VPX_INFRA_UPD_HA_CP PRIMARY KEY (CLUSTER_ID, PROVIDER_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_CP_CID FOREIGN KEY (CLUSTER_ID)
      REFERENCES VPX_INFRA_UPD_HA_CLSTR_CFG(CLUSTER_ID) ON DELETE CASCADE,
   CONSTRAINT FK_VPX_INFRA_UPD_HA_CP_PID FOREIGN KEY (PROVIDER_ID)
      REFERENCES VPX_INFRA_UPD_HA_PROVIDER(PROVIDER_ID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_HU_INFO                              */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_HU_INFO(
   HU_INFO_ID     INTEGER NOT NULL,
   PROVIDER_ID    INTEGER,
   NAME           VARCHAR(56),
   COMPONENT_TYPE VARCHAR(56),
   DESCRIPTION    VARCHAR(255),
   CONSTRAINT PK_VPX_INFRA_UPD_HA_HU_INFO PRIMARY KEY (HU_INFO_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_HU_INFO_P FOREIGN KEY (PROVIDER_ID)
      REFERENCES VPX_INFRA_UPD_HA_PROVIDER(PROVIDER_ID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_FILTER                               */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_FILTER(
   FILTER_ID   INTEGER NOT NULL,
   PROVIDER_ID INTEGER,
   UUID        CHAR(47),
   NAME        VARCHAR(56),
   CONSTRAINT PK_VPX_INFRA_UPD_HA_FILTER PRIMARY KEY (FILTER_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_FILTER_P FOREIGN KEY (PROVIDER_ID)
      REFERENCES VPX_INFRA_UPD_HA_PROVIDER(PROVIDER_ID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_FLTR_INF                             */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_FLTR_INF(
   FILTER_ID   INTEGER NOT NULL,
   HU_INFO_ID  INTEGER NOT NULL,
   CONSTRAINT PK_VPX_INFRA_UPD_HA_FLTR_INF PRIMARY KEY (FILTER_ID, HU_INFO_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_FLTR_INF FOREIGN KEY (FILTER_ID)
      REFERENCES VPX_INFRA_UPD_HA_FILTER(FILTER_ID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_F_C_CFG                              */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_F_C_CFG(
   FILTER_ID   INTEGER NOT NULL,
   CLUSTER_ID  BIGINT NOT NULL,
   CONSTRAINT PK_VPX_INFRA_UPD_HA_F_C_CFG PRIMARY KEY (FILTER_ID, CLUSTER_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_F_C_CFG_F FOREIGN KEY (FILTER_ID)
      REFERENCES VPX_INFRA_UPD_HA_FILTER(FILTER_ID) ON DELETE CASCADE,
   CONSTRAINT FK_VPX_INFRA_UPD_HA_F_C_CFG_C FOREIGN KEY (CLUSTER_ID)
      REFERENCES VPX_COMPUTE_RESOURCE(ID) ON DELETE CASCADE
);

CREATE INDEX VPXI_INFRA_UPD_HA_F_C_CFG_CLU ON VPX_INFRA_UPD_HA_F_C_CFG(CLUSTER_ID);

/*==============================================================*/
/* Table: VPX_INFRA_UPD_HA_F_H_CFG                              */
/*==============================================================*/

CREATE TABLE VPX_INFRA_UPD_HA_F_H_CFG(
   FILTER_ID   INTEGER NOT NULL,
   HOST_ID     BIGINT NOT NULL,
   CONSTRAINT PK_VPX_INFRA_UPD_HA_F_H_CFG PRIMARY KEY (FILTER_ID, HOST_ID),
   CONSTRAINT FK_VPX_INFRA_UPD_HA_F_H_CFG_F FOREIGN KEY (FILTER_ID)
      REFERENCES VPX_INFRA_UPD_HA_FILTER(FILTER_ID) ON DELETE CASCADE,
   CONSTRAINT FK_VPX_INFRA_UPD_HA_F_H_CFG_C FOREIGN KEY (HOST_ID)
      REFERENCES VPX_HOST(ID) ON DELETE CASCADE
);

CREATE INDEX VPXI_INFRA_UPD_HA_F_H_CFG_HOST ON VPX_INFRA_UPD_HA_F_H_CFG(HOST_ID);

/*==============================================================*/
/* Table: VPX_CP_POLICY                                         */
/*==============================================================*/

CREATE TABLE VPX_CP_POLICY(
   POLICY_ID      INTEGER         NOT NULL,
   POLICY_UUID    CHAR(36)        NOT NULL,
   POLICY_INFO    TEXT            NOT NULL,
   CONSTRAINT PK_VPX_CP_POLICY    PRIMARY KEY (POLICY_ID)
);

/*==============================================================*/
/* Table: VPX_HCI_CONFIG_INFO                                   */
/*==============================================================*/

CREATE TABLE VPX_HCI_CONFIG_INFO(
   CLUSTER_ID           BIGINT          NOT NULL,
   LOCKDOWN_MODE        INTEGER         NULL,
   DATETIME_CONFIG      TEXT            NULL,
   HCI_WORKFLOW_STATE   VARCHAR(64)     NOT NULL,
   CONFIGURED_HOSTS     TEXT            NULL,
   MIN_ESX_VERSION      VARCHAR(255)    NULL,
   CONSTRAINT PK_VPX_HCI_CONFIG_INFO PRIMARY KEY (CLUSTER_ID),
   CONSTRAINT FK_VPX_HCI_CONFIG_INFO FOREIGN KEY (CLUSTER_ID)
      REFERENCES VPX_COMPUTE_RESOURCE(ID) ON DELETE CASCADE
);

/*==============================================================*/
/* Table: VPX_HCI_DVS_SETTINGS                                  */
/*==============================================================*/

CREATE TABLE VPX_HCI_DVS_SETTINGS(
   DVS_ID               BIGINT          NOT NULL,
   PHYSICAL_NICS        TEXT            NOT NULL,
   CLUSTER_ID           BIGINT          NOT NULL,
   CONSTRAINT PK_VPX_HCI_DVS_SETTINGS PRIMARY KEY (DVS_ID, CLUSTER_ID),
   CONSTRAINT FK_VPX_HCI_DVS_SETTINGS FOREIGN KEY (CLUSTER_ID)
      REFERENCES VPX_HCI_CONFIG_INFO(CLUSTER_ID) ON DELETE CASCADE
);

CREATE INDEX VPX_HCI_DVS_SETTINGS_CID_IDX ON VPX_HCI_DVS_SETTINGS(CLUSTER_ID);

/*==============================================================*/
/* Table: VPX_HCI_NW_SETTINGS                                   */
/*==============================================================*/

CREATE TABLE VPX_HCI_NW_SETTINGS(
   DVPG_ID              BIGINT          NOT NULL,
   SERVICE_TYPE         VARCHAR(64)     NOT NULL,
   DVS_ID               BIGINT          NOT NULL,
   CLUSTER_ID           BIGINT          NOT NULL,
   CONSTRAINT PK_VPX_HCI_NW_SETTINGS PRIMARY KEY (DVPG_ID, SERVICE_TYPE, CLUSTER_ID),
   CONSTRAINT FK_VPX_HCI_NW_SETTINGS FOREIGN KEY (DVS_ID, CLUSTER_ID)
      REFERENCES VPX_HCI_DVS_SETTINGS(DVS_ID, CLUSTER_ID) ON DELETE CASCADE
);

CREATE INDEX VPX_HCI_NW_SETTINGS_DC_IDX ON VPX_HCI_NW_SETTINGS(DVS_ID, CLUSTER_ID);

/*==============================================================*/
/* Table: VPX_PATCH_VERSION                                     */
/*==============================================================*/

CREATE TABLE VPX_PATCH_VERSION(
    INITIAL_VERSION VARCHAR(10) NOT NULL,
    CURRENT_VERSION VARCHAR(10) NULL);

INSERT INTO VPX_PATCH_VERSION (INITIAL_VERSION) VALUES ('65053');

/*==============================================================*/
/* Index: #172866                                               */
/*==============================================================*/
--SET tablespace back to vcseat
SELECT PREFTABLESPACE('alarm');
CREATE INDEX VPX_ALARM_F1  ON VPX_ALARM(ENTITY_TYPE);
--Reset tablespace back to default
RESET default_tablespace;

CREATE INDEX VPX_COMPUTE_RESOURCE_F1 ON VPX_COMPUTE_RESOURCE(RESOURCE_GROUP_ID);
CREATE INDEX VPX_ENTITY_F1 ON VPX_ENTITY(PARENT_ID);

CREATE INDEX VPX_SCHEDULEDTASK_F1 ON VPX_SCHEDULEDTASK(ENTITY_TYPE);
CREATE INDEX VPX_SNAPSHOT_F1 ON VPX_SNAPSHOT(VM_ID);

--SET tablespace back to vcseat
SELECT PREFTABLESPACE('task');
CREATE INDEX VPX_TASK_F1 ON VPX_TASK(ENTITY_TYPE);
--Reset tablespace back to default
RESET default_tablespace;

CREATE INDEX  VPX_EXT_CLIENT_EXT_ID_F1 ON VPX_EXT_CLIENT (EXT_ID);
CREATE INDEX  VPX_EXT_SERVER_EXT_ID_F1 ON VPX_EXT_SERVER (EXT_ID);
CREATE INDEX  VPX_EXT_SERVMAIL_EXTSERID_F1 ON VPX_EXT_SERVER_EMAIL (EXT_SERVER_ID);
CREATE INDEX  VPX_HOST_PROFREFHOST_ENTID_F1 ON VPX_HOST_PROFILE (REF_HOST_ENTITY_ID);
CREATE INDEX  VPX_IP_POOL_ASSOCASSET_ID_F1 ON VPX_IP_POOL_ASSOCIATION (POOL_ID);
CREATE INDEX  VPX_PROFANS_FILE_HOST_ID_F1 ON VPX_PROFILE_ANSWER_FILE (HOST_ID);
CREATE INDEX  VPX_COMPL_STATUS_PROFID_F1 ON VPX_COMPLIANCE_STATUS (PROFILE_ID);
CREATE INDEX  VPX_COMPL_STATUS_ENTITY_ID_F1 ON VPX_COMPLIANCE_STATUS (ENTITY_ID);

/*==============================================================*/
/* Bug #674834                                                  */
/*==============================================================*/
CREATE INDEX VPX_COMPUTE_RES_USER_HB_DS_F1 ON VPX_COMPUTE_RES_USER_HB_DS(DS_ID);
CREATE INDEX VPX_DAS_HB_DATASTORE_SYS_F1 ON VPX_DAS_HB_DATASTORE_SYS(HOST_ID);
CREATE INDEX VPX_DAS_HB_DATASTORE_SYS_F2 ON VPX_DAS_HB_DATASTORE_SYS(DATASTORE_ID);
CREATE INDEX VPX_PROFILE_ENTITY_ASSC_F1 ON VPX_PROFILE_ENTITY_ASSOCIATION(ENTITY_ID);

/*==============================================================*/
/* Bug #700426                                                  */
/*==============================================================*/
CREATE INDEX VPX_TEXT_ARRAY_M2 ON VPX_TEXT_ARRAY(MO_TYPE, MO_ID, TYPE_ID, ARRAY_ID);
CREATE INDEX VPX_DS_INFO_M1 ON VPX_DS_INFO(VMFS_UUID);
CREATE INDEX VPX_DS_INFO_M2 ON VPX_DS_INFO(ID, VMFS_UUID);
CREATE INDEX VPX_DS_ASSIGNMENT_M1 ON VPX_DS_ASSIGNMENT(DS_ID, ACCESSIBLE);
CREATE INDEX VPX_SAMPLE_TIME1_M2 ON VPX_SAMPLE_TIME1(TIME_ID, SAMPLE_TIME) ;
CREATE INDEX VPX_SAMPLE_TIME2_M2 ON VPX_SAMPLE_TIME2(TIME_ID, SAMPLE_TIME) ;
CREATE INDEX VPX_SAMPLE_TIME3_M2 ON VPX_SAMPLE_TIME3(TIME_ID, SAMPLE_TIME) ;
CREATE INDEX VPX_SAMPLE_TIME4_M2 ON VPX_SAMPLE_TIME4(TIME_ID, SAMPLE_TIME) ;
CREATE INDEX VPX_STAT_ID_M1 ON VPX_STAT_ID(MOID);

/*==============================================================*/
/* Metadata:                                                    */
/*==============================================================*/
INSERT INTO vpx_object_type VALUES (0, 'VM');
INSERT INTO vpx_object_type VALUES (1, 'HOST');
INSERT INTO vpx_object_type VALUES (2, 'COMPUTE_RESOURCE');
INSERT INTO vpx_object_type VALUES (3, 'CLUSTER_COMPUTE_RESOURCE');
INSERT INTO vpx_object_type VALUES (4, 'RESOURCE POOL');
INSERT INTO vpx_object_type VALUES (5, 'VM_FOLDER');
INSERT INTO vpx_object_type VALUES (6, 'HOST_FOLDER');
INSERT INTO vpx_object_type VALUES (7, 'DATACENTER_FOLDER');
INSERT INTO vpx_object_type VALUES (8, 'DATACENTER');
INSERT INTO vpx_object_type VALUES (9, 'ALARM');
INSERT INTO vpx_object_type VALUES (10, 'SCHEDULED_TASK');
INSERT INTO vpx_object_type VALUES (11, 'TASK');
INSERT INTO vpx_object_type VALUES (12, 'EXTENSION');
INSERT INTO vpx_object_type VALUES (13, 'VAPP');
INSERT INTO vpx_object_type VALUES (14, 'DVSWITCH');
INSERT INTO vpx_object_type VALUES (15, 'DVPORTGROUP');
INSERT INTO vpx_object_type VALUES (16, 'DATASTORE_FOLDER');
INSERT INTO vpx_object_type VALUES (17, 'NETWORK_FOLDER');
INSERT INTO vpx_object_type VALUES (18, 'DATASTORE');
INSERT INTO vpx_object_type VALUES (19, 'NETWORK');
INSERT INTO vpx_object_type VALUES (20, 'STORAGEPOD');
INSERT INTO vpx_object_type VALUES (21, 'OPAQUE_NETWORK');
INSERT INTO vpx_object_type VALUES (22, 'VIRTUAL_DATACENTER');
INSERT INTO vpx_object_type VALUES (23, 'CONTENT_LIBRARY');
INSERT INTO vpx_object_type VALUES (24, 'CONTENT_LIBRARY_ITEM');
INSERT INTO vpx_object_type VALUES (25, 'TAG_POLICY');
INSERT INTO vpx_object_type VALUES (26, 'TAG_POLICY_OPTION');
INSERT INTO vpx_object_type VALUES (27, 'ANTI_AFFINITY_GROUP');

INSERT INTO VPX_TYPE_MAP VALUES ('cpuAffinity', 1, null);
INSERT INTO VPX_TYPE_MAP VALUES ('cpuFeatureMask', 2, null);
INSERT INTO VPX_TYPE_MAP VALUES ('datastoreUrl', 3, null);
INSERT INTO VPX_TYPE_MAP VALUES ('ftInfo', 4, null);
INSERT INTO VPX_TYPE_MAP VALUES ('npivNodeWorldWideName', 5, null);
INSERT INTO VPX_TYPE_MAP VALUES ('npivPortWorldWideName', 6, null);
INSERT INTO VPX_TYPE_MAP VALUES ('memoryAffinity', 7, null);
INSERT INTO VPX_TYPE_MAP VALUES ('extraConfig', 8, null);
INSERT INTO VPX_TYPE_MAP VALUES ('autoStart', 13, null);
INSERT INTO VPX_TYPE_MAP VALUES ('localSwapDatastore', 22, null);
INSERT INTO VPX_TYPE_MAP VALUES ('option', 25, null);
INSERT INTO VPX_TYPE_MAP VALUES ('optionDef', 26, null);
INSERT INTO VPX_TYPE_MAP VALUES ('snapshot.disk.chain.fileKey', 42, null);
INSERT INTO VPX_TYPE_MAP VALUES ('vAppConfig', 43, null);
INSERT INTO VPX_TYPE_MAP VALUES ('disk.chain.fileKey', 55, null);
INSERT INTO VPX_TYPE_MAP VALUES ('authenticationManagerInfo', 59, null);
INSERT INTO VPX_TYPE_MAP VALUES ('family', 63, null);
INSERT INTO VPX_TYPE_MAP VALUES ('speed', 64, null);
INSERT INTO VPX_TYPE_MAP VALUES ('cacheConfigurationInfo', 67, null);
INSERT INTO VPX_TYPE_MAP VALUES ('scheduledHardwareUpgradeInfo.fault', 69, null);
INSERT INTO VPX_TYPE_MAP VALUES ('tools.lastInstallInfo.fault', 70, null);
INSERT INTO VPX_TYPE_MAP VALUES ('nas.remoteHostNames', 78, null);
INSERT INTO VPX_TYPE_MAP VALUES ('vvolDS.vasaProviderInfo', 80, null);
INSERT INTO VPX_TYPE_MAP VALUES ('vvolDS.storageArray', 81, null);
INSERT INTO VPX_TYPE_MAP VALUES ('graphicsInfo', 85, null);
INSERT INTO VPX_TYPE_MAP VALUES ('hardware.device.iofilter', 86, null);
INSERT INTO VPX_TYPE_MAP VALUES ('keyId', 87, null);
INSERT INTO VPX_TYPE_MAP VALUES ('layoutEx', 88, null);

INSERT INTO VPX_STAT_DEV_TYPE_DEF VALUES(1,'VMID');
INSERT INTO VPX_STAT_DEV_TYPE_DEF VALUES(2,'DSID');
INSERT INTO VPX_STAT_DEV_TYPE_DEF VALUES(3,'DISKFILE');
INSERT INTO VPX_STAT_DEV_TYPE_DEF VALUES(4,'DELTAFILE');
INSERT INTO VPX_STAT_DEV_TYPE_DEF VALUES(5,'SWAPFILE');
INSERT INTO VPX_STAT_DEV_TYPE_DEF VALUES(6,'OTHERFILE');

/*==============================================================*/
/* Lock key                                                     */
/*==============================================================*/
INSERT INTO vpx_lock VALUES (0);

/*==============================================================*/
/* Version                                                      */
/*==============================================================*/
INSERT INTO vpx_version VALUES (670, 'VirtualCenter Database 6.7');

/*==============================================================*/
/* VPX_TERMINATION_REASON                                       */
/* NOTE: Changes to these must reflect                          */
/*   vpx-main:vpx/vpxd/exitType.h                           */
/*==============================================================*/

INSERT INTO VPX_TERMINATION_REASON VALUES (1000, 'Normal Termination');
INSERT INTO VPX_TERMINATION_REASON VALUES (1500, 'License Expired');
INSERT INTO VPX_TERMINATION_REASON VALUES (1600, 'Initialization Failure');
INSERT INTO VPX_TERMINATION_REASON VALUES (1650, 'Signal - Normal Exit');
INSERT INTO VPX_TERMINATION_REASON VALUES (5000, 'Abnormal Termination');
INSERT INTO VPX_TERMINATION_REASON VALUES (5100, 'Signal - Abnormal Exit');
INSERT INTO VPX_TERMINATION_REASON VALUES (5150, 'Unhandled Exception');
INSERT INTO VPX_TERMINATION_REASON VALUES (9000, 'Unknown Termination');

/*==============================================================*/
/* VPX_PRODUCT                                                  */
/* NOTE: Changes to these must reflect                          */
/*   vc-vmacore-main:vim/lib/public/vmacore/ProductDb.h         */
/*==============================================================*/

INSERT INTO VPX_PRODUCT VALUES (10, 'VMware vCenter Server');

/*==============================================================*/
/* DUAL                                                         */
/*==============================================================*/
Insert into VPX_DUAL values('X');

/*==============================================================*/
/* The VMware assigned 3rd party assets                         */
/*==============================================================*/

INSERT INTO VPX_LIC_TPS_ASSETS (ASSET_ID, ASSET_NAME, DESCRIPTION) VALUES (0, 'vmware-vsphere', 'VMware Visor');
INSERT INTO VPX_LIC_TPS_ASSETS (ASSET_ID, ASSET_NAME, DESCRIPTION) VALUES (1, 'emc-powerpath', 'EMC PowerPath module');

/*==============================================================*/
/* VCBD Monitoring Counters                                     */
/*==============================================================*/

INSERT INTO VPX_DBM_COUNTER_METADATA(COUNTER_ID, NAME, OBJECT_NAME, UNIT, RANGE_TYPE, RANGE_MIN, RANGE_MAX, KEEP_DAYS, DESCRIPTION, SOLUTION, SQL_STATEMENT)
VALUES( 1,
        'Memory:Buffer Cache Hit Ratio',
        'PostgreSQL:Buffer Cache',
        'percent',
        'range',
        85,
        100,
        2,
        'The buffer cache hit ratio indicates the percentage of time that the database manager did not need to load a page from disk in order to service a page request because the page was already in the buffer cache. The greater the buffer cache hit ratio, the lower the frequency of disk I/O.',
        'DBA Need to look into Memory optimization',
        'select round((blks_hit - blks_read) / blks_hit, 4) as buff_hit_ratio from (select sum(heap_blks_hit + idx_blks_hit + toast_blks_hit + tidx_blks_hit) as blks_hit, sum(heap_blks_read + idx_blks_read + toast_blks_read + tidx_blks_read) as blks_read from pg_statio_all_tables) as buff');

INSERT INTO VPX_DBM_COUNTER_METADATA(COUNTER_ID, NAME, OBJECT_NAME, UNIT, RANGE_TYPE, RANGE_MIN, RANGE_MAX, KEEP_DAYS, DESCRIPTION, SOLUTION, SQL_STATEMENT)
VALUES( 2,
        'General:User Connections',
        'PostgreSQL:General Statistics',
        'count',
        'range',
        NULL,
        90,
        2,
        'The number of users currently connected to the PostgreSQL.',
        'DBA Need to adjust maximum worker threads',
        'select count(0) from pg_stat_activity where not procpid = pg_backend_pid()');

INSERT INTO VPX_DBM_COUNTER_METADATA(COUNTER_ID, NAME, OBJECT_NAME, UNIT, RANGE_TYPE, RANGE_MIN, RANGE_MAX, KEEP_DAYS, DESCRIPTION, SOLUTION, SQL_STATEMENT)
VALUES( 3,
        'Storage:Checkpoint frequency in minutes',
        'PostgreSQL:WAL',
        'minutes',
        'range',
        NULL,
        30,
        2,
        'If checkpoint frequency is small then should be checked if write-ahead log(WAL) checkpoints occure too often. High frequency helps crash recovery but increases disk I/O.',
        'DBA need to look into WAL checkpoints configuration',
	'SELECT seconds_since_start / total_checkpoints / 60 FROM (SELECT EXTRACT(EPOCH FROM (now() - pg_postmaster_start_time())) AS seconds_since_start, (checkpoints_timed+checkpoints_req) AS total_checkpoints FROM pg_stat_bgwriter) AS sub' );

INSERT INTO VPX_DBM_COUNTER_METADATA(COUNTER_ID, NAME, OBJECT_NAME, UNIT, RANGE_TYPE, RANGE_MIN, RANGE_MAX, KEEP_DAYS, DESCRIPTION, SOLUTION, SQL_STATEMENT)
VALUES( 4,
        'Storage:Database backend space allocation',
        'PostgreSQL:Buffer space allocation',
        'percent',
        'range',
        NULL,
        80,
        2,
        'Percentage when a database backend had to write a page in order to make space for new checkpoint allocation.',
        'DBA need to look into background writer in advance',
        'select (buffers_backend * 100) / (buffers_checkpoint + buffers_clean + buffers_backend) from pg_stat_bgwriter');

COMMIT;
