【问题描述】:查询速度问题,在mysql中查询,一般不超过1ms,在tidb中查询,时间为7ms(在建立连接的情况下初次查询有时超过30ms)。
【 TiDB 使用环境】生产环境
Tidb:3pd,3kv,3db
Tidb:无写入,
Mysql:单机,无写入
数据记录:520万条记录
【 TiDB 版本】v8.3.0
【 查询语句】:
select * from business_msg where sign_number=‘17747715421’;
【表结构】
表结构:
CREATE TABLE business_msg
(
sign_number
varchar(20) NOT NULL COMMENT ‘签约号码’,
called_format
varchar(50) DEFAULT ‘’ COMMENT ‘被叫号码格式’,
sign_type
varchar(50) DEFAULT ‘’ COMMENT ‘签约类型’,
record_flag
varchar(50) DEFAULT ‘’ COMMENT ‘录音标识’,
sign_code
varchar(100) DEFAULT ‘’ COMMENT ‘签约业务编码’,
custom_id
varchar(100) DEFAULT ‘’ COMMENT ‘平台客户’,
playback_sound_address
varchar(200) DEFAULT ‘’ COMMENT ‘放音地址’,
bridge_flag
int(1) DEFAULT NULL COMMENT ‘变号标识’,
valid_flag
int(1) DEFAULT NULL COMMENT ‘有效标志’,
use_origin_call
int(1) DEFAULT ‘0’ COMMENT ‘使用原主叫标志’,
use_origin_called
int(1) DEFAULT ‘0’ COMMENT ‘使用原被叫标志’,
call_no
varchar(50) NOT NULL DEFAULT ‘0’ COMMENT ‘主叫’,
called_no
varchar(50) NOT NULL DEFAULT ‘0’ COMMENT ‘被叫’,
display_no
varchar(50) NOT NULL DEFAULT ‘0’ COMMENT ‘显示号码’,
real_called_no
varchar(50) NOT NULL DEFAULT ‘0’ COMMENT ‘被叫’,
route
varchar(100) DEFAULT ‘’ COMMENT ‘下一跳地址’,
domain
varchar(200) DEFAULT ‘’ COMMENT ‘域名’,
create_time
varchar(100) DEFAULT ‘’ COMMENT ‘创建时间’,
create_user
varchar(50) DEFAULT ‘’ COMMENT ‘创建人’,
modify_time
varchar(100) DEFAULT ‘’ COMMENT ‘修改时间’,
modify_user
varchar(50) DEFAULT ‘’ COMMENT ‘修改人’,
trace_flag
int(1) DEFAULT ‘0’ COMMENT ‘跟踪标志’,
hangup_flag
int(1) DEFAULT ‘0’ COMMENT ‘挂断标志’,
max_call_counts
int(5) DEFAULT ‘1’ COMMENT ‘最大通话数’,
record_mode
varchar(20) DEFAULT ‘0’ COMMENT ‘录音模式’,
before_connect_dtmf_flag
int(1) DEFAULT ‘0’ COMMENT ‘53’,
before_connect_playback_sound_address
varchar(200) DEFAULT ‘’ COMMENT ‘123’,
hangup_tone
varchar(200) DEFAULT ‘’ COMMENT ‘123’,
max_dtmf_counts
int(5) DEFAULT ‘4’ COMMENT ‘123’,
query_ctrl_flag
int(1) DEFAULT ‘0’ COMMENT ‘访问ctrl标志’,
music_on_hold_flag
int(1) DEFAULT ‘0’ COMMENT ‘标志’,
event_flag
int(1) DEFAULT ‘0’ COMMENT ‘56’,
music_on_hold_class
varchar(200) DEFAULT ‘’ COMMENT ‘68’,
data_binding_path
varchar(200) DEFAULT ‘’ COMMENT ‘数据地址’,
value_added_service
varchar(50) DEFAULT ‘0’ COMMENT ‘增值’,
data_binding_access_flag
varchar(50) DEFAULT ‘0’ COMMENT ‘值为数字型字符串’,
suspend_number
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘’,
forbid_international
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘禁止呼叫’,
forbid_special_number_outcoming
int(11) NOT NULL DEFAULT ‘0’ COMMENT ‘禁止呼出’,
forbid_special_number_incoming
int(11) NOT NULL DEFAULT ‘0’ COMMENT ‘禁止呼入’,
forbid_color_ring
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘不支持’,
forbid_video
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘不支持’,
color_ring_addr
varchar(100) NOT NULL DEFAULT ‘’ COMMENT ‘645’,
forbid_playback_sound_continue
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘66756’,
forbid_short_message
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘786’,
binding_timeout
int(11) DEFAULT ‘1100’ COMMENT ‘超时时间,单位毫秒’,
proxy_media
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘代理’,
record_samping
tinyint(4) NOT NULL DEFAULT ‘0’ COMMENT ‘抽样’,
reserve1_bit
bit(64) NOT NULL DEFAULT b’0’ COMMENT ‘预留位操作字段1’,
reserve2_bit
bit(64) NOT NULL DEFAULT b’0’ COMMENT ‘预留位操作字段2’,
reserve3_bit
bit(64) NOT NULL DEFAULT b’0’ COMMENT ‘预留位操作字段3’,
reserve4_bit
bit(64) NOT NULL DEFAULT b’0’ COMMENT ‘预留位操作字段4’,
reserve5_bit
bit(64) NOT NULL DEFAULT b’0’ COMMENT ‘预留位操作字段5’,
reserve1_char
varchar(100) NOT NULL DEFAULT ‘’ COMMENT ‘预留字符串操作字段1’,
reserve2_char
varchar(100) NOT NULL DEFAULT ‘’ COMMENT ‘预留字符串操作字段2’,
reserve3_char
varchar(100) NOT NULL DEFAULT ‘’ COMMENT ‘预留字符串操作字段3’,
reserve4_char
varchar(100) NOT NULL DEFAULT ‘’ COMMENT ‘预留字符串操作字段4’,
reserve5_char
varchar(100) NOT NULL DEFAULT ‘’ COMMENT ‘预留字符串操作字段5’,
PRIMARY KEY (sign_number
,call_no
,called_no
,display_no
,real_called_no
) /*T![clustered_index] CLUSTERED */,
KEY custom_id
(custom_id
),
KEY sign_number
(sign_number
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT=‘规则表’;