aid title f1 f2 f3 f41 测试1 1 1 1 1
2 测试2 2 2 2 2
3 测试3 3 5 6 7
4 测试4 4 4 4 4
5 测试5 1 2 3 4
6 测试6 6 5 4 3
7 测试7 4 3 2 1
8 测试8 5 2 2 1
9 测试5 3 4 5 6
9 测试6 3 4 5 2
10 测试5 3 2 1 4
f1-f4的值只有1-9数字!title为不固定6个字以内
如果建索引符合检索快搜索如下几个select title from a where title='测试5'select title from a where title='测试5' and f1='3'select title from a where title='测试5' and f1='3' and f2='1'select title from a where title='测试5' and f1='3' and f2='1' and f3='2'select title from a where title='测试5' and f1='3' and f2='1' and f3='2' and f4 ='1'select title from a where title='测试5' and f2='3' and f3='1'select title from a where title='测试5' and f1='3' and f2='1' and f4='2'求能现实上面搜索结果和对应建索引的效果最好!就是速度最快第一个问题 sql语句能优化吗第二个问题 怎么样建索引达到检索最快求高手能把表结构发上来!就是已经建好索引的结构和优化查询的语句非常感谢!不知道分表好不好!如把f1-f4独立出来
a
id title
1 测试1
2 测试2
3 测试3
4 测试4
5 测试5b
id f1
1 1
2 2
3 3
4 4
5 1
c
id f2
1 1
2 2
3 5
4 4
5 2
d
id f3
1 1
2 2
3 6
4 4
5 3
e
id f4
1 1
2 2
3 7
4 4
5 4这样现实上面会不会效果好一些呢?多表联合查询效果会不会慢感谢大家的解答谢谢
2 测试2 2 2 2 2
3 测试3 3 5 6 7
4 测试4 4 4 4 4
5 测试5 1 2 3 4
6 测试6 6 5 4 3
7 测试7 4 3 2 1
8 测试8 5 2 2 1
9 测试5 3 4 5 6
9 测试6 3 4 5 2
10 测试5 3 2 1 4
f1-f4的值只有1-9数字!title为不固定6个字以内
如果建索引符合检索快搜索如下几个select title from a where title='测试5'select title from a where title='测试5' and f1='3'select title from a where title='测试5' and f1='3' and f2='1'select title from a where title='测试5' and f1='3' and f2='1' and f3='2'select title from a where title='测试5' and f1='3' and f2='1' and f3='2' and f4 ='1'select title from a where title='测试5' and f2='3' and f3='1'select title from a where title='测试5' and f1='3' and f2='1' and f4='2'求能现实上面搜索结果和对应建索引的效果最好!就是速度最快第一个问题 sql语句能优化吗第二个问题 怎么样建索引达到检索最快求高手能把表结构发上来!就是已经建好索引的结构和优化查询的语句非常感谢!不知道分表好不好!如把f1-f4独立出来
a
id title
1 测试1
2 测试2
3 测试3
4 测试4
5 测试5b
id f1
1 1
2 2
3 3
4 4
5 1
c
id f2
1 1
2 2
3 5
4 4
5 2
d
id f3
1 1
2 2
3 6
4 4
5 3
e
id f4
1 1
2 2
3 7
4 4
5 4这样现实上面会不会效果好一些呢?多表联合查询效果会不会慢感谢大家的解答谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货