create table wallet_gold_asset_record_1 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_2 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_3 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_4 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_5 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_6 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_7 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_8 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_9 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_10 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_11 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; create table wallet_gold_asset_record_12 ( id bigint not null comment '流水记录ID', sys_origin varchar(50) default '' not null comment '系统来源', user_id bigint default 0 not null comment '用户id', penny_amount bigint default 0 not null comment '金额', penny_balance bigint default 0 not null comment '当前余额', type tinyint(1) default 0 not null comment ' 类型0.收入 1.消耗', event_type varchar(50) default '0' not null comment ' 事件类型', event_desc varchar(150) default '0' not null comment ' 事件描述', event_id varchar(50) default '0' not null comment ' 事件id', op_user_type tinyint(1) default 0 not null comment ' 操作用户类型(0.app用户, 1.后台管理用户)', create_time bigint not null comment '创建时间', update_time bigint not null comment '修改时间', create_user bigint null comment '创建用户', update_user bigint null comment '修改用户', primary key (id) ) comment '用户金币资产流水'; ALTER TABLE wallet_gold_asset_record_1 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_1 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_1 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_2 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_2 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_2 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_3 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_3 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_3 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_4 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_4 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_4 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_5 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_5 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_5 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_6 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_6 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_6 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_7 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_7 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_7 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_8 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_8 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_8 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_9 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_9 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_9 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_10 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_10 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_10 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_11 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_11 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_11 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); ALTER TABLE wallet_gold_asset_record_12 ADD INDEX idx_uid (user_id); ALTER TABLE wallet_gold_asset_record_12 ADD INDEX idx_event (event_id); ALTER TABLE wallet_gold_asset_record_12 ADD INDEX idx_sorigin_etype_ctime (sys_origin,event_type,create_time); # 测试索引 explain xxx; show index from wallet_gold_asset_record_9; ALTER TABLE wallet_gold_asset_record_9 DROP INDEX idx_uid_type_etype_ctime; OPTIMIZE TABLE wallet_gold_asset_record_9;