在Mysql数据库表中,哪个搜索更快?(string或int)

时间:2016-05-15 13:12:11

标签: mysql database mysqli

在Mysql数据库表中,哪个搜索更快?

1-在字符串列中搜索 2-在数字行中搜索

1-示例数据
column_string include <long string> <type: text>: sdf,sdfa,sdfaf,sfdsdf,sdfsg,sfdfg,sdfe,qwer,qwe,rt,45dg,sf,34wer,we3,q3e,sdf,wersg,sg,sfgef,e,f,w,s,w,sdf,sd,w,sdf,sg,fg,sdfa,sdfaf,sfdsdf,sdfsg,sfdfg,sdfe,qwer,qwe,rt,45dg,sf,34wer,we3,q3e,sdf,wersg,sg,sfgef,e,f,w,s,w,sdf,sd,w,sdf,sg,fg,sdfa,sdfaf,sfdsdf,sdfsg,sfdfg,sdfe,qwer,iopiop,rt,45dg,sf,34wer,we3,q3e,sdf,wersg,sg,sfgef,e,f,w,s,w,ioipi,sd,w,sdf,sg,fg,sdfa,sdfaf,sfdsdf,sdfsg,sfdfg,sdfe,qwer,qwe,rt,45dg,sf,34wer,asdfsdf,q3e,sdf,wersg,sg,sfgef,e,f,w,s,w,sdf,sd,w,sdf,sg,fg,sdfa,sdfaf,sfdsdf,sdfsg,sfdfg,sdfe,qwer,qwe,rt,45dg,sf,34wer,we3,q3e,sdf,wersg,sg,sfgef,e,f,w,s,w,sdf,sd,w,sdf,sg,fg,sdfa,sdfaf,sfdsdf,sdfsg,sfdfg,sdfe,qwer,qwe,rt,45dg,sf,34wer,we3,q3e,sdf,wersg,sg,sfgef,e,f,w,s,w,sdf,sd,w,sdf,sg,fg,.....

2-示例数据
tbl row 1 --> id: 1 tbl row 2 --> id: 2 . . tbl row 95100984612346 --> id: 95100984612346

1-示例查询:
select column_string(type=text) from tbl where column_string.include("mystring")

2-示例查询:
select id from tbl where id == 25100984612346

哪种搜索更快?

1 个答案:

答案 0 :(得分:1)

在具有主键的数字字段中,MySQL数据库搜索中的

会更快。