oceanbase/unittest/sql/optimizer/test_optimizer_schema.sql
oceanbase-admin cea7de1475 init push
2021-05-31 22:56:52 +08:00

282 lines
27 KiB
SQL

create database opt;
use opt;
create table t20(c1 int, c2 int);
create index t20_c2 on t20(c2) local;
create table tidx(c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, primary key(c1));
create index tidx_c2 on tidx(c2, c3) local;
create table t0(pk int primary key, c1 int, c2 int, a3 int);
create table t1(c1 int primary key, c2 int) partition by hash (c1) partitions 5;
create table t2(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 3;
create table t3(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 2;
create index idx_t1_c2 on t1(c2) LOCAL;
create table t4(c1 int, c2 int, c3 int, primary key(c1, c2));
create index idx_t4_c2_c3 on t4(c2, c3) local;
create index idx_t4_c3 on t4(c3) local;
create index idx_t4_c2 on t4(c2) local;
create table t5(c1 int, c2 int, c3 int, primary key(c2,c3)) partition by key(c2, c3) partitions 3;
create index idx_t5_c2 on t5(c2) LOCAL;
create index idx_t5_c3 on t5(c3) LOCAL;
create table t6(c1 int primary key, c2 tinyint) partition by key(c1) partitions 3;
create table t6_1(c1 int primary key, c2 tinyint) partition by key(c1) partitions 2;
create table t7(c1 int primary key, c2 int);
create table t8(c1 int primary key, c2 int);
create table t2_no_part(c1 int primary key, c2 int, c3 int);
create table t9(c1 int primary key, c2 int not null default 1, c3 int default 2);
create table t10(c1 int, c2 int, c3 int, primary key(c1,c2)) partition by hash (c2) partitions 2;
create table t11(c1 int, c2 int, c3 int, primary key(c1,c2)) partition by hash (c2) partitions 2;
create table t12(a bigint primary key, b char(20), c bigint);
create table t13(b char(20), c bigint, a bigint primary key);
create table t14(c1 int, c2 int, c3 int, primary key(c1, c2, c3)) partition by hash (c3) partitions 5;
create table t15(c1 int, c2 int, c3 varchar(32)) partition by key (c1) partitions 4;
create table z1(a int primary key, b int, c int ,d int);
create table z2(a int primary key, b int, c int ,d int);
create index z1_b on z1(b) local;
create index z2_b on z2(b) local;
create table t16(c1 int, c2 int, c3 int, primary key(c3,c2)) partition by key(c2, c3) partitions 3;
create table t17(c1 int, c2 int, c3 int, primary key(c1,c2,c3)) partition by hash(c2+c3) partitions 3;
create table t18(c1 int, c2 int, c3 int, primary key(c1,c2,c3)) partition by hash(c2+c3) partitions 3;
create table t19(c1 int, c2 int, c3 int, c4 int, c5 int, primary key(c1, c2, c3, c4));
create table tt1 (c1 varchar(10) primary key, c2 varchar(10)) collate utf8_general_ci;
create table tt2 (c1 varchar(10) primary key, c2 varchar(10)) collate utf8_bin;
create table set_t1(pk1 int primary key, a1 int, a2 int);
create table set_t2(pk2 int primary key, b1 int, b2 int);
create table CC(col_int_key int(11) DEFAULT NULL, col_varchar_10 varchar(10) DEFAULT NULL, col_varchar_20 varchar(20) DEFAULT NULL);
create table sbtest(c1 bigint primary key, c2 int);
create table sbtest1(c1 int primary key, c2 int, index c(c2));
create table t_u(c1 bigint unsigned) partition by hash(c1) partitions 3;
create table t_func(c1 int, c2 int, c3 int, primary key(c1, c2)) partition by hash(floor(c2+c1)) partitions 5;
create table t_f(c1 int, c2 int, c3 int) partition by hash(floor(c2+c1)) partitions 5;
create table tp(c1 int primary key, c2 int) partition by hash (mod(c1, 1000)) partitions 5;
create table ts(c1 int, c2 datetime, primary key(c1, c2)) partition by hash(c1) subpartition by range columns(c2) subpartition template (subpartition p0 values less than ('2013-10-10'), subpartition p1 values less than ('2016-3-30')) partitions 2;
create table tr(c1 int, c2 int, primary key(c1,c2)) partition by range(c1) (partition p0 values less than(10), partition p1 values less than(100), partition p2 values less than(1000));
create table ts2(c1 int, c2 datetime, c3 int, c4 datetime, primary key(c3, c4)) partition by hash(c3) subpartition by range columns(c3, c4) subpartition template (subpartition p0 values less than (2, '2013-10-10'), subpartition p1 values less than (100, '2016-3-30')) partitions 2;
create table t_s1(c1 int, c2 datetime, primary key(c1, c2)) partition by hash(c1) subpartition by range columns(c2) subpartition template (subpartition p0 values less than ('2013-10-10'), subpartition p1 values less than ('2016-3-30')) partitions 2;
create table t_s2(c1 int, c2 datetime) partition by hash(c1) subpartition by range columns(c2) subpartition template (subpartition p0 values less than ('2013-10-10'), subpartition p1 values less than ('2016-3-30')) partitions 2;
create table t_3(c1 int primary key, c2 int, c3 varchar(32)) partition by hash (c1) partitions 2;
create table t_s(c1 int, c2 datetime, primary key(c1, c2)) partition by hash(c1) subpartition by range columns(c2) subpartition template (subpartition p0 values less than ('2013-10-10'), subpartition p1 values less than ('2016-3-30')) partitions 2;
create table t_idx_back(c1 int primary key, c2 int, c3 int);
create index t_idx_c2 on t_idx_back(c2) storing (c3) local;
create table tg(c1 varchar(10) primary key, c2 varchar(8) generated always as (substring(c1, 2)) virtual, c3 int, unique key t31(c3, c1) local) partition by key(c2) partitions 5;
create table t_pt(c1 int, c2 int, c3 int, c4 int, primary key(c1,c2)) partition by hash(c1) partitions 10;
create index t_pt_idx_1 on t_pt(c2,c1) local;
create database hint;
use hint;
create table t1(a int primary key, b int);
create table t2(a int primary key, b int);
create index idx_t1_a on t1(a) LOCAL;
create database insert_db;
use insert_db;
create table t1(c1 int primary key, c2 int);
create table t2(c1 int, c2 int);
create table t3(c1 int primary key, c2 int, c3 int);
create table t4(c1 int primary key, c2 int) partition by hash(c1) partitions 3;
use opt;
create table t_idx(c1 int primary key, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, c17 int, c18 int, c19 int, c20 int, c21 int, c22 int, c23 int, c24 int, c25 int, c26 int, c27 int, c28 int, c29 int, c30 int, c31 int, c32 int, c33 int, c34 int, c35 int, c36 int, c37 int, c38 int, c39 int, c40 int, c41 int, c42 int, c43 int, c44 int, c45 int, c46 int, c47 int, c48 int, c49 int, c50 int, c51 int, c52 int, c53 int, c54 int, c55 int, c56 int, c57 int, c58 int, c59 int, c60 int, c61 int, c62 int, c63 int, c64 int, c65 int, c66 int, c67 int, c68 int, c69 int, c70 int, c71 int, c72 int, c73 int, c74 int, c75 int, c76 int, c77 int, c78 int, c79 int, c80 int, c81 int, c82 int, c83 int, c84 int, c85 int, c86 int, c87 int, c88 int, c89 int, c90 int, c91 int, c92 int, c93 int, c94 int, c95 int, c96 int, c97 int, c98 int, c99 int, c100 int, c101 int, c102 int, c103 int, c104 int, c105 int, c106 int, c107 int, c108 int, c109 int, c110 int, c111 int, c112 int, c113 int, c114 int, c115 int, c116 int, c117 int, c118 int, c119 int, c120 int, c121 int, c122 int, c123 int, c124 int, c125 int, c126 int, c127 int, c128 int, c129 int);
create index idx_t_idx_c2 on t_idx(c2) LOCAL;
create index idx_t_idx_c3 on t_idx(c3) LOCAL;
create index idx_t_idx_c4 on t_idx(c4) LOCAL;
create index idx_t_idx_c5 on t_idx(c5) LOCAL;
create index idx_t_idx_c6 on t_idx(c6) LOCAL;
create index idx_t_idx_c7 on t_idx(c7) LOCAL;
create index idx_t_idx_c8 on t_idx(c8) LOCAL;
create index idx_t_idx_c9 on t_idx(c9) LOCAL;
create index idx_t_idx_c10 on t_idx(c10) LOCAL;
create index idx_t_idx_c11 on t_idx(c11) LOCAL;
create index idx_t_idx_c12 on t_idx(c12) LOCAL;
create index idx_t_idx_c13 on t_idx(c13) LOCAL;
create index idx_t_idx_c14 on t_idx(c14) LOCAL;
create index idx_t_idx_c15 on t_idx(c15) LOCAL;
create index idx_t_idx_c16 on t_idx(c16) LOCAL;
create index idx_t_idx_c17 on t_idx(c17) LOCAL;
create index idx_t_idx_c18 on t_idx(c18) LOCAL;
create index idx_t_idx_c19 on t_idx(c19) LOCAL;
create index idx_t_idx_c20 on t_idx(c20) LOCAL;
create index idx_t_idx_c21 on t_idx(c21) LOCAL;
create index idx_t_idx_c22 on t_idx(c22) LOCAL;
create index idx_t_idx_c23 on t_idx(c23) LOCAL;
create index idx_t_idx_c24 on t_idx(c24) LOCAL;
create index idx_t_idx_c25 on t_idx(c25) LOCAL;
create index idx_t_idx_c26 on t_idx(c26) LOCAL;
create index idx_t_idx_c27 on t_idx(c27) LOCAL;
create index idx_t_idx_c28 on t_idx(c28) LOCAL;
create index idx_t_idx_c29 on t_idx(c29) LOCAL;
create index idx_t_idx_c30 on t_idx(c30) LOCAL;
create index idx_t_idx_c31 on t_idx(c31) LOCAL;
create index idx_t_idx_c32 on t_idx(c32) LOCAL;
create index idx_t_idx_c33 on t_idx(c33) LOCAL;
create index idx_t_idx_c34 on t_idx(c34) LOCAL;
create index idx_t_idx_c35 on t_idx(c35) LOCAL;
create index idx_t_idx_c36 on t_idx(c36) LOCAL;
create index idx_t_idx_c37 on t_idx(c37) LOCAL;
create index idx_t_idx_c38 on t_idx(c38) LOCAL;
create index idx_t_idx_c39 on t_idx(c39) LOCAL;
create index idx_t_idx_c40 on t_idx(c40) LOCAL;
create index idx_t_idx_c41 on t_idx(c41) LOCAL;
create index idx_t_idx_c42 on t_idx(c42) LOCAL;
create index idx_t_idx_c43 on t_idx(c43) LOCAL;
create index idx_t_idx_c44 on t_idx(c44) LOCAL;
create index idx_t_idx_c45 on t_idx(c45) LOCAL;
create index idx_t_idx_c46 on t_idx(c46) LOCAL;
create index idx_t_idx_c47 on t_idx(c47) LOCAL;
create index idx_t_idx_c48 on t_idx(c48) LOCAL;
create index idx_t_idx_c49 on t_idx(c49) LOCAL;
create index idx_t_idx_c50 on t_idx(c50) LOCAL;
create index idx_t_idx_c51 on t_idx(c51) LOCAL;
create index idx_t_idx_c52 on t_idx(c52) LOCAL;
create index idx_t_idx_c53 on t_idx(c53) LOCAL;
create index idx_t_idx_c54 on t_idx(c54) LOCAL;
create index idx_t_idx_c55 on t_idx(c55) LOCAL;
create index idx_t_idx_c56 on t_idx(c56) LOCAL;
create index idx_t_idx_c57 on t_idx(c57) LOCAL;
create index idx_t_idx_c58 on t_idx(c58) LOCAL;
create index idx_t_idx_c59 on t_idx(c59) LOCAL;
create index idx_t_idx_c60 on t_idx(c60) LOCAL;
create index idx_t_idx_c61 on t_idx(c61) LOCAL;
create index idx_t_idx_c62 on t_idx(c62) LOCAL;
create index idx_t_idx_c63 on t_idx(c63) LOCAL;
create index idx_t_idx_c64 on t_idx(c64) LOCAL;
create index idx_t_idx_c65 on t_idx(c65) LOCAL;
create index idx_t_idx_c66 on t_idx(c66) LOCAL;
create index idx_t_idx_c67 on t_idx(c67) LOCAL;
create index idx_t_idx_c68 on t_idx(c68) LOCAL;
create index idx_t_idx_c69 on t_idx(c69) LOCAL;
create index idx_t_idx_c70 on t_idx(c70) LOCAL;
create index idx_t_idx_c71 on t_idx(c71) LOCAL;
create index idx_t_idx_c72 on t_idx(c72) LOCAL;
create index idx_t_idx_c73 on t_idx(c73) LOCAL;
create index idx_t_idx_c74 on t_idx(c74) LOCAL;
create index idx_t_idx_c75 on t_idx(c75) LOCAL;
create index idx_t_idx_c76 on t_idx(c76) LOCAL;
create index idx_t_idx_c77 on t_idx(c77) LOCAL;
create index idx_t_idx_c78 on t_idx(c78) LOCAL;
create index idx_t_idx_c79 on t_idx(c79) LOCAL;
create index idx_t_idx_c80 on t_idx(c80) LOCAL;
create index idx_t_idx_c81 on t_idx(c81) LOCAL;
create index idx_t_idx_c82 on t_idx(c82) LOCAL;
create index idx_t_idx_c83 on t_idx(c83) LOCAL;
create index idx_t_idx_c84 on t_idx(c84) LOCAL;
create index idx_t_idx_c85 on t_idx(c85) LOCAL;
create index idx_t_idx_c86 on t_idx(c86) LOCAL;
create index idx_t_idx_c87 on t_idx(c87) LOCAL;
create index idx_t_idx_c88 on t_idx(c88) LOCAL;
create index idx_t_idx_c89 on t_idx(c89) LOCAL;
create index idx_t_idx_c90 on t_idx(c90) LOCAL;
create index idx_t_idx_c91 on t_idx(c91) LOCAL;
create index idx_t_idx_c92 on t_idx(c92) LOCAL;
create index idx_t_idx_c93 on t_idx(c93) LOCAL;
create index idx_t_idx_c94 on t_idx(c94) LOCAL;
create index idx_t_idx_c95 on t_idx(c95) LOCAL;
create index idx_t_idx_c96 on t_idx(c96) LOCAL;
create index idx_t_idx_c97 on t_idx(c97) LOCAL;
create index idx_t_idx_c98 on t_idx(c98) LOCAL;
create index idx_t_idx_c99 on t_idx(c99) LOCAL;
create index idx_t_idx_c100 on t_idx(c100) LOCAL;
create index idx_t_idx_c101 on t_idx(c101) LOCAL;
create index idx_t_idx_c102 on t_idx(c102) LOCAL;
create index idx_t_idx_c103 on t_idx(c103) LOCAL;
create index idx_t_idx_c104 on t_idx(c104) LOCAL;
create index idx_t_idx_c105 on t_idx(c105) LOCAL;
create index idx_t_idx_c106 on t_idx(c106) LOCAL;
create index idx_t_idx_c107 on t_idx(c107) LOCAL;
create index idx_t_idx_c108 on t_idx(c108) LOCAL;
create index idx_t_idx_c109 on t_idx(c109) LOCAL;
create index idx_t_idx_c110 on t_idx(c110) LOCAL;
create index idx_t_idx_c111 on t_idx(c111) LOCAL;
create index idx_t_idx_c112 on t_idx(c112) LOCAL;
create index idx_t_idx_c113 on t_idx(c113) LOCAL;
create index idx_t_idx_c114 on t_idx(c114) LOCAL;
create index idx_t_idx_c115 on t_idx(c115) LOCAL;
create index idx_t_idx_c116 on t_idx(c116) LOCAL;
create index idx_t_idx_c117 on t_idx(c117) LOCAL;
create index idx_t_idx_c118 on t_idx(c118) LOCAL;
create index idx_t_idx_c119 on t_idx(c119) LOCAL;
create index idx_t_idx_c120 on t_idx(c120) LOCAL;
create index idx_t_idx_c121 on t_idx(c121) LOCAL;
create index idx_t_idx_c122 on t_idx(c122) LOCAL;
create index idx_t_idx_c123 on t_idx(c123) LOCAL;
create index idx_t_idx_c124 on t_idx(c124) LOCAL;
create index idx_t_idx_c125 on t_idx(c125) LOCAL;
create index idx_t_idx_c126 on t_idx(c126) LOCAL;
create index idx_t_idx_c127 on t_idx(c127) LOCAL;
create index idx_t_idx_c128 on t_idx(c128) LOCAL;
create index idx_t_idx_c129 on t_idx(c129) LOCAL;
create table yuming(c1 float(10, 5), c2 float(10, 5), primary key(c1, c2));
create table query_range(c1 int, c2 int, c3 int, c4 int, c5 int, primary key(c1, c2, c3));
CREATE TABLE query_range1(c1 int(31) NOT NULL, `c2` decimal(5,1) DEFAULT NULL, `c3` int(123) DEFAULT NULL, `c4` int(6) DEFAULT NULL, `c5` int(19) NOT NULL, `c6` int(105) DEFAULT NULL, `c7` tinyint(112) NOT NULL, `c8` decimal(26,6) NOT NULL, `c9` decimal(14,4) NOT NULL, `c10` varbinary(18) DEFAULT NULL, `c11` decimal(35,8) NOT NULL, `c12` int(3) NOT NULL, PRIMARY KEY (`c9`, `c11`, `c8`, `c1`, `c12`, `c7`, `c5`), KEY `i_BX` (`c2`) BLOCK_SIZE 16384);
CREATE TABLE `trade_base_000` (`TRADE_NO` bigint(64) NOT NULL, `TRADE_TYPE` varchar(8) NOT NULL, `PRODUCT` varchar(40) DEFAULT NULL, PRIMARY KEY (`TRADE_NO`)) partition by hash (trade_no) partitions 400
CREATE TABLE `trade_process_000` (`TRADE_NO` bigint(64) NOT NULL,`RECEIVE_FEE` int(11) NOT NULL DEFAULT '0',`GMT_RECEIVE_PAY` datetime DEFAULT NULL,PRIMARY KEY (`TRADE_NO`), UNIQUE KEY `IND_BYD_TRD_PROCESS_GRPAY` (`GMT_RECEIVE_PAY`, `RECEIVE_FEE`, `TRADE_NO`) LOCAL) partition by hash (trade_no) partitions 400
create table t_normal_idx(c1 int primary key, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int);
create index idx on t_normal_idx(c2,c3,c4,c5,c6) local;
create table y_t1(c1 int primary key, c2 varchar(20), c3 int unsigned);
create index y_t1_i1 on y_t1(c2) local;
create index y_t1_i2 on y_t1(c3) local;
create table y_t3(a varchar(10) collate utf8mb4_bin);
create table agg_t1(c1 int primary key);
create table agg_t2(c2 int primary key);
create table tg1(c1 int, c2 int, c3 int, c4 int, c5 int, primary key(c1,c2,c3));
create table tg2(c1 int, c2 int, c3 int, c4 int, c5 int, primary key(c1,c2,c3));
create table y_t4(c1 int, c2 int, c3 int, primary key(c1, c2, c3));
create table y_t5(a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(248) default ' ');
create index idx_t1_1 on y_t5(a1,a2,b,c) local;
create table y_t6(c1 int primary key, c2 int, c3 int, c4 int);
create index y_t6_i1 on y_t6(c2, c3) local;
create table y_t7(c1 bigint, c2 varchar(64), c3 datetime);
CREATE TABLE sbtest_sysbench (id int(10) unsigned NOT NULL AUTO_INCREMENT, k int(10) unsigned NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '', PRIMARY KEY (id));
create index key_1 on sbtest_sysbench(k) local;
create table test_insert (c1 int, c2 int, c3 int, c4 int default 5 primary key) partition by hash(c4) partitions 3;
create table t1_topk (c1 int primary key, c2 int, c3 varchar(32)) partition by hash(c1) partitions 2;
create table t2_topk (c1 int primary key, c2 int, c3 varchar(32)) partition by hash(c1) partitions 2;
create table t3_topk (c1 int primary key, c2 int, c3 varchar(32)) partition by hash(c1) partitions 2;
CREATE TABLE `iw_account_log_00` ( `iw_account_log_id` bigint(15) NOT NULL, `trans_log_id` bigint(15) NOT NULL, `trans_date` char(8) NOT NULL, `out_date` char(8) NOT NULL, `trans_dt` timestamp(6) NOT NULL, `trans_code` char(4) NOT NULL, `trans_amount` bigint(15) NOT NULL, `balance` bigint(15) NOT NULL, `trans_currency` char(3) NOT NULL DEFAULT '156', `account_type` bigint(2) NOT NULL, `trans_account` varchar(20) NOT NULL, `other_account_type` bigint(2) NOT NULL, `other_account` varchar(25) DEFAULT NULL, `trans_institution` varchar(10) DEFAULT NULL, `trans_out_order_no` varchar(128) DEFAULT NULL, `bank_name` varchar(100) DEFAULT NULL, `trans_memo` varchar(256) DEFAULT NULL, `sub_trans_code` varchar(6) DEFAULT NULL, `out_biz_no` varchar(128) DEFAULT NULL, `model` bigint(2) DEFAULT NULL, `suite_id` varchar(64) DEFAULT NULL, `is_write_off` char(1) DEFAULT NULL, `is_red` char(1) DEFAULT NULL, `other_account_log` bigint(15) DEFAULT NULL, `delete_flag` char(1) DEFAULT NULL, `voucher_id` varchar(32) DEFAULT NULL, `orgi_voucher_id` varchar(32) DEFAULT NULL, `trans_operator` varchar(8) DEFAULT NULL, `inst_channel_api` varchar(32) DEFAULT NULL, `gmt_create` timestamp(6) NULL DEFAULT NULL, `gmt_modified` timestamp(6) NULL DEFAULT NULL, `inst_id` varchar(32) DEFAULT NULL, `biz_trans_uniq` varchar(128) DEFAULT NULL, `end_to_end_id` varchar(128) DEFAULT NULL, `other_display_info` varchar(64) DEFAULT NULL, `biz_pd_code` varchar(21) DEFAULT NULL, `biz_ev_code` varchar(8) DEFAULT NULL, `cnl_pd_code` varchar(21) DEFAULT NULL, `cnl_ev_code` varchar(8) DEFAULT NULL, `cnl_no` varchar(64) DEFAULT NULL, `pd_code` varchar(21) DEFAULT NULL, `ev_code` varchar(8) DEFAULT NULL, `asset_code` varchar(32) DEFAULT NULL, `csu_tx_id` varchar(36) DEFAULT '-1', PRIMARY KEY (`iw_account_log_id`, `trans_dt`), KEY `iw_account_log_tatd_ind` (`trans_account`, `trans_dt`) , KEY `iw_account_log_toon_ind` (`trans_out_order_no`)) DEFAULT CHARSET = utf8mb4;
CREATE TABLE `skyline_int` ( `tenant_id` varchar(8) NOT NULL , `id` int NOT NULL, `v1` int NOT NULL, `v2` int NOT NULL, `v3` int NOT NULL, `v4` int NOT NULL, `v5` int NOT NULL, `v6` int NOT NULL, `gmt_create` timestamp NOT NULL, `gmt_modified` timestamp NOT NULL, PRIMARY KEY (v1, tenant_id));
create index `idx_tenant_id` on skyline_int (tenant_id) local;
create index `idx_v2` on skyline_int (v2) local;
create index `idx_v2_v3` on skyline_int (v2, v3) local;
create index `idx_v3_v2` on skyline_int (v3, v2) local;
create index `idx_v2_v3_v4` on skyline_int (v2, v3, v4) local;
create index `idx_v3_v4_v2` on skyline_int (v3, v4, v2) local;
create index `idx_v4_v2_v3` on skyline_int (v4, v2, v3) local;
create index `idx_v2_v3_v4_v5` on skyline_int (v2, v3, v4, v5) local;
create index `idx_v3_v4_v5_v2` on skyline_int (v3, v4, v5, v2) local;
create index `idx_v4_v5_v2_v3` on skyline_int (v4, v5, v2, v3) local;
create index `idx_v5_v2_v3_v4` on skyline_int (v5, v2, v3, v4) local;
create index `idx_v2_v3_v4_v5_v6` on skyline_int (v2, v3, v4, v5, v6) local;
create index `idx_v3_v4_v5_v6_v2` on skyline_int (v3, v4, v5, v6, v2) local;
create index `idx_v4_v5_v6_v2_v3` on skyline_int (v4, v5, v6, v2, v3) local;
create index `idx_v5_v6_v2_v3_v4` on skyline_int (v5, v6, v2, v3, v4) local;
create index `idx_v6_v2_v3_v4_v5` on skyline_int (v6, v2, v3, v4, v5) local;
create table test_limit(a1 int, a2 int, a3 int, a4 int, a5 int, a6 int);
create table sourceTable(id int primary key, sales int);
create table sourceTable_2(id2 int primary key, sales2 int);
create table targetTable(id int primary key, sales int);
create table target1(id int, c2 int, c3 int, primary key(id, c2));
create table target2(id int, c2 int);
create table hint_t1 (c1 int);
create table hint_t2 (c2 int);
create view hint_v1 as (select * from hint_t2);
CREATE TABLE `rpt_adgroup_tag_realtime` ( `custid` bigint(20) NOT NULL, `thedate` datetime NOT NULL, `productlineid` bigint(20) NOT NULL, `campaignid` bigint(20) NOT NULL, `adgroupid` bigint(20) NOT NULL, `targetingtagid` bigint(20) NOT NULL, `tagvalue` bigint(20) NOT NULL, `pid` varchar(200) NOT NULL, `hour` bigint(20) NOT NULL, `traffictype` bigint(20) NOT NULL, `mechanism` bigint(20) NOT NULL, `productid` bigint(20) NOT NULL, `impression` bigint(20) DEFAULT NULL, `click` bigint(20) DEFAULT NULL, `cost` bigint(20) DEFAULT NULL, `directtransaction` bigint(20) DEFAULT NULL, `indirecttransaction` bigint(20) DEFAULT NULL, `directtransactionshipping` bigint(20) DEFAULT NULL, `indirecttransactionshipping` bigint(20) DEFAULT NULL, `favitemtotal` bigint(20) DEFAULT NULL, `favshoptotal` bigint(20) DEFAULT NULL, `directcarttotal` bigint(20) DEFAULT NULL, `indirectcarttotal` bigint(20) DEFAULT NULL, `impression_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `directtransaction_h` bigint(20) DEFAULT NULL COMMENT '离线修正>字段', `favshoptotal_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `cost_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `directtransactionshipping_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `indirectcarttotal_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `cost_fix` bigint(20) DEFAULT NULL COMMENT '反作弊修正字段', `favitemtotal_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `click_fix` bigint(20) DEFAULT NULL COMMENT '反作弊修正字段', `indirecttransaction_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `directcarttotal_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `indirecttransactionshipping_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', `click_h` bigint(20) DEFAULT NULL COMMENT '离线修正字段', PRIMARY KEY (`custid`, `thedate`, `productlineid`, `campaignid`, `adgroupid`, `targetingtagid`, `tagvalue`, `pid`, `hour`, `traffictype`, `mechanism`, `productid`)) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 partition by range columns(thedate) subpartition by hash(custid) subpartitions 30(partition p20170904 values less than ('2017-09-04 00:00:00'),partition p20170911 values less than ('2017-09-11 00:00:00'),partition p20170918 values less than ('2017-09-18 00:00:00'),partition p20170925 values less than ('2017-09-25 00:00:00'),partition p20171002 values less than ('2017-10-02 00:00:00'),partition p20171009 values less than ('2017-10-09 00:00:00'),partition p20171016 values less than ('2017-10-16 00:00:00'),partition p20171023 values less than ('2017-10-23 00:00:00'),partition p20171030 values less than ('2017-10-30 00:00:00'),partition p20171106 values less than ('2017-11-06 00:00:00'),partition p20171113 values less than ('2017-11-13 00:00:00'),partition p20171120 values less than ('2017-11-20 00:00:00'));
CREATE TABLE `cb_loan_acctbal_01` ( `acctnbr` varchar(34) NOT NULL COMMENT '账号', `balcatcd` varchar(4) NOT NULL COMMENT '余额类别代码', `baltypcd` varchar(4) NOT NULL COMMENT '余额类型代码', `preeffdate` date DEFAULT NULL COMMENT '上次生效日期', `preamt` decimal(21,5) DEFAULT '0.00000' COMMENT '上次金额', `effdate` date NOT NULL COMMENT '余额生效日期', `amt` decimal(21,5) NOT NULL DEFAULT '0.00000' COMMENT '账户金额', `mainttellerid` varchar(20) DEFAULT NULL COMMENT '维护柜员', `maintbranchnbr` varchar(12) DEFAULT NULL COMMENT '维护机构', `gmt_create` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '维护日期', `gmt_modified` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '维护时间', `oddfreqnextduedate` date DEFAULT NULL COMMENT '不规则还款频率的下次应收日期', `nextrcvbnbr` bigint(20) DEFAULT NULL COMMENT '该账号的下个应收编号', `nextratechangedate` date DEFAULT NULL COMMENT '下个利率变更日期', PRIMARY KEY(`balcatcd`, `baltypcd`, `effdate`, `acctnbr`));
CREATE TABLE `rpt_dim_bpp4p_timeup_item` ( `custid` bigint(20) NOT NULL COMMENT 'custid', `memberid` bigint(20) NOT NULL COMMENT 'memberid', `itemid` bigint(20) NOT NULL COMMENT '宝贝id', `itemdate` date DEFAULT NULL COMMENT '上架日期', `p4pdate` date DEFAULT NULL COMMENT '直通车开始推广日期,未上车为空', `thedate` date DEFAULT NULL COMMENT '更新日期', PRIMARY KEY (`custid`, `memberid`, `itemid`), KEY `idx_custid_itemdate_p4pdate` (`custid`, `itemdate`, `p4pdate`) BLOCK_SIZE 16384);
CREATE TABLE `rpt_bpp4p_timeup_adgroup` ( `thedate` date NOT NULL COMMENT '日期', `custid` bigint(20) NOT NULL COMMENT '客户ID', `memberid` bigint(20) NOT NULL COMMENT '广告主ID', `campaignid` bigint(20) NOT NULL COMMENT '推广计划id', `adgroupid` bigint(20) NOT NULL COMMENT '推广组id', `itemid` bigint(20) DEFAULT NULL COMMENT '宝贝 id', `p4pdate` date DEFAULT NULL COMMENT '上车日期', `potentialindex` bigint(20) DEFAULT NULL COMMENT '潜力指数', `impression1d` bigint(20) DEFAULT NULL COMMENT '广告展现量', `validclickcnt1d` bigint(20) DEFAULT NULL COMMENT '有效点击', `validprice1d` bigint(20) DEFAULT NULL COMMENT '有效消耗', `ranksum1d` bigint(20) DEFAULT NULL COMMENT '排名总和', `finclickcnt1d` bigint(20) DEFAULT NULL COMMENT '财务点击', `finprice1d` bigint(20) DEFAULT NULL COMMENT '财务消耗', `finclickuv1d` bigint(20) DEFAULT NULL COMMENT '财务点击uv', `finclicknewuv1d` bigint(20) DEFAULT NULL COMMENT '财务点击新客uv', `ealipaycnt15d` bigint(20) DEFAULT NULL COMMENT '15天累计ALIPAY成交笔数', `ealipayamt15d` bigint(20) DEFAULT NULL COMMENT '15天累计ALIPAY成交金额', `eitemcollcnt15d` bigint(20) DEFAULT NULL COMMENT '15天累计收藏宝贝数', `ecartcnt15d` bigint(20) DEFAULT NULL COMMENT '15天累计宝贝放购物车数', `esearchpv15d` bigint(20) DEFAULT NULL COMMENT '自然流量曝光', PRIMARY KEY (`custid`, `thedate`, `memberid`, `campaignid`, `adgroupid`)) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 COMMENT = '直通车adgroup数据:定时上架 vs 普通上架';
create database query_range;
use query_range;
create table range_t1(a int, b int, primary key(a, b));
create table test1 (id int,dt datetime(6), primary key(id, dt));
create database calc_partition;
use calc_partition;
create table part_hash(a int, b int, primary key(a)) partition by hash(a) partitions 5;
create table part_hash2(a int, b int, primary key(a, b)) partition by hash(a+b) partitions 5;
create table part_key(a int, b varchar(10), primary key(a, b)) partition by key(b) partitions 5;
create table part_key2(a int, b int, primary key(a, b)) partition by key(a, b) partitions 5;
create table part_range(id int, thedate datetime, primary key(id, thedate)) partition by range columns(thedate)(partition p20150101 values less than('20150101'), partition p20160101 values less than('20160101'), partition p20170101 values less than('20170101'), partition p20180101 values less than('20180101'), partition p20190101 values less than('20190101'));
create table part_range_hash(id int, thedate datetime, primary key(id, thedate)) partition by range columns(thedate) subpartition by hash(id) subpartitions 5 (partition p20150101 values less than('20150101'), partition p20160101 values less than('20160101'), partition p20170101 values less than('20170101'), partition p20180101 values less than('20180101'), partition p20190101 values less than('20190101'));
use opt;
CREATE TABLE `cb_dep_acct_54` ( `acctnbr` bigint(20) NOT NULL, `curracctstatcd` varchar(4) NOT NULL, PRIMARY KEY (`acctnbr`)) partition by hash(acctnbr) partitions 5;
CREATE TABLE `cb_dep_acctbal_54` ( `acctnbr` bigint(20) NOT NULL, `balcatcd` varchar(4) NOT NULL, `baltypcd` varchar(4) NOT NULL, PRIMARY KEY (`acctnbr`, `balcatcd`, `baltypcd`));
CREATE TABLE `cb_dep_rxtnbal_54` ( `acctnbr` varchar(34) NOT NULL, `rtxnnbr` bigint(20) NOT NULL, `balcatcd` varchar(4) NOT NULL, `baltypcd` varchar(4) NOT NULL);
create table t_time (c1 date primary key);