TiDB 版本:4.0
问题描述:查询耗时较长(统计耗时更长,稍后贴出资料),麻烦给看下
sql语句
EXPLAIN ANALYZE
select * from
tb_data where sj >= ‘2021-01-24 00:00:00’ and hphm like ‘鲁QA%’;
表结构
CREATE TABLE tb_data
(
id
bigint(21) NOT NULL ,
areaid
bigint(5) DEFAULT NULL ,
hpzl
varchar(10) DEFAULT NULL ,
hphm
varchar(20) DEFAULT NULL ,
wfxw
varchar(6) DEFAULT NULL ,
sj
datetime DEFAULT NULL ,
sbbh
varchar(20) NOT NULL ,
ip
varchar(20) DEFAULT NULL ,
cjsj
datetime DEFAULT NULL COMMENT ‘创建时间’,
gxsj
datetime DEFAULT NULL ,
clfl
varchar(50) DEFAULT NULL ,
plate_type
int(2) DEFAULT NULL ,
plate_color
int(3) DEFAULT NULL ,
bright
varchar(10) DEFAULT NULL ,
entire_believe
int(3) DEFAULT NULL ,
w_speed
decimal(5,2) DEFAULT NULL,
vehicle_logo_recog
int(3) DEFAULT NULL,
vehicle_sub_logo_recog
varchar(20) DEFAULT NULL ,
vehicle_type
int(3) DEFAULT NULL ,
dir
int(2) DEFAULT NULL ,
detect_type
int(2) DEFAULT NULL ,
relaLane_direction_type
varchar(10) DEFAULT NULL ,
car_direction_type
int(2) DEFAULT NULL ,
illegal_fromat_type
int(2) DEFAULT NULL ,
pendant
int(2) DEFAULT NULL ,
data_analysis
int(2) DEFAULT NULL ,
yellow_label_car
int(2) DEFAULT NULL ,
dangerous_vehicles
int(2) DEFAULT NULL ,
pilot_safebelt
int(2) DEFAULT NULL ,
copilot_safebelt
int(2) DEFAULT NULL ,
pilot_sun_visor
int(2) DEFAULT NULL ,
copilot_sun_visor
int(2) DEFAULT NULL ,
pilot_call
int(2) DEFAULT NULL ,
barrier_gate_ctrl_type
int(2) DEFAULT NULL ,
alarm_data_type
int(2) DEFAULT NULL ,
stru_snap_first_picTime
datetime DEFAULT NULL ,
dw_illegal_time
int(11) DEFAULT NULL ,
zpsl
int(2) NOT NULL ,
filedir
varchar(50) DEFAULT NULL ,
spwjm
varchar(20) DEFAULT NULL ,
zpwjm
varchar(50) DEFAULT NULL ,
zpstr1
varchar(50) DEFAULT NULL,
zpstr2
varchar(50) DEFAULT NULL,
zpstr3
varchar(20) DEFAULT NULL,
csys
varchar(3) DEFAULT NULL ,
delflag
int(1) DEFAULT 1 ,
source
int(1) DEFAULT NULL ,
remark
varchar(10) DEFAULT NULL ,
cdbh
varchar(4) DEFAULT NULL ,
ddbh
varchar(6) DEFAULT NULL ,
PRIMARY KEY (id
),
KEY NewIndex1
(sbbh
),
KEY NewIndex5
(wfxw
),
KEY NewIndex7
(delflag
),
KEY NewIndex4
(hphm
),
KEY NewIndex2
(hpzl
),
KEY NewIndex3
(sj
),
KEY NewIndex6
(sbbh
),
KEY NewIndex8
(cjsj
),
KEY NewIndex9
(plate_color
),
KEY NewIndex10
(dir
),
KEY NewIndex11
(ddbh
),
KEY NewIndex12
(csys
),
KEY NewIndex13
(source
),
KEY NewIndex14
(pilot_sun_visor
),
KEY NewIndex15
(vehicle_type
),
KEY index_cdbh
(cdbh
),
KEY NewIndex16
(vehicle_logo_recog
),
KEY index_wspeed
(w_speed
),
KEY pilot_safebelt
(pilot_safebelt
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT=‘数据表’