PageRenderTime 11ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/metastore/scripts/upgrade/mysql/005-HIVE-417.mysql.sql

#
SQL | 28 lines | 27 code | 1 blank | 0 comment | 0 complexity | 5f69977b66327d3d50e82b701bcbca36 MD5 | raw file
 1SELECT '< HIVE-417 Implement Indexing in Hive >' AS ' ';
 2CREATE TABLE IF NOT EXISTS `IDXS` (
 3  `INDEX_ID` bigint(20) NOT NULL,
 4  `CREATE_TIME` int(11) NOT NULL,
 5  `DEFERRED_REBUILD` bit(1) NOT NULL,
 6  `INDEX_HANDLER_CLASS` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
 7  `INDEX_NAME` varchar(128) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
 8  `INDEX_TBL_ID` bigint(20) DEFAULT NULL,
 9  `LAST_ACCESS_TIME` int(11) NOT NULL,
10  `ORIG_TBL_ID` bigint(20) DEFAULT NULL,
11  `SD_ID` bigint(20) DEFAULT NULL,
12  PRIMARY KEY (`INDEX_ID`),
13  UNIQUE KEY `UNIQUEINDEX` (`INDEX_NAME`,`ORIG_TBL_ID`),
14  KEY `IDXS_FK1` (`SD_ID`),
15  KEY `IDXS_FK2` (`INDEX_TBL_ID`),
16  KEY `IDXS_FK3` (`ORIG_TBL_ID`),
17  CONSTRAINT `IDXS_FK1` FOREIGN KEY (`SD_ID`) REFERENCES `SDS` (`SD_ID`),
18  CONSTRAINT `IDXS_FK2` FOREIGN KEY (`INDEX_TBL_ID`) REFERENCES `TBLS` (`TBL_ID`),
19  CONSTRAINT `IDXS_FK3` FOREIGN KEY (`ORIG_TBL_ID`) REFERENCES `TBLS` (`TBL_ID`)
20) ENGINE=InnoDB DEFAULT CHARSET=latin1;
21
22CREATE TABLE IF NOT EXISTS `INDEX_PARAMS` (
23  `INDEX_ID` bigint(20) NOT NULL,
24  `PARAM_KEY` varchar(256) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
25  `PARAM_VALUE` varchar(767) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
26  PRIMARY KEY (`INDEX_ID`,`PARAM_KEY`),
27  CONSTRAINT `INDEX_PARAMS_FK1` FOREIGN KEY (`INDEX_ID`) REFERENCES `IDXS` (`INDEX_ID`)
28) ENGINE=InnoDB DEFAULT CHARSET=latin1;