voice_file表有2000条数据,search_job_result表有250万条。
sqlString = "select v.voice_file_id,time_to_sec(v.duration) as duration, " +
"v.audio_channel,v.create_time, s.confidence_score,s.phrase_id, " +
"time_to_sec(s.start_time) as start_time, time_to_sec(s.end_time) as end_time " +
"from (select confidence_score, phrase_id, start_time, end_time, voice_file_id " +
"from search_job_result limit "+(j * 100000)+",100000"+") s, voice_file v where s.voice_file_id = v.voice_file_id";其中参数j是外层一个for循环的传入参数。即for(int j=0;j<25;j++).现在的问题是当j为10以内时,查询速度很快,而j数值越大时,查询速度越来越慢。大家能帮我分析其中的原因吗?
sqlString = "select v.voice_file_id,time_to_sec(v.duration) as duration, " +
"v.audio_channel,v.create_time, s.confidence_score,s.phrase_id, " +
"time_to_sec(s.start_time) as start_time, time_to_sec(s.end_time) as end_time " +
"from (select confidence_score, phrase_id, start_time, end_time, voice_file_id " +
"from search_job_result limit "+(j * 100000)+",100000"+") s, voice_file v where s.voice_file_id = v.voice_file_id";其中参数j是外层一个for循环的传入参数。即for(int j=0;j<25;j++).现在的问题是当j为10以内时,查询速度很快,而j数值越大时,查询速度越来越慢。大家能帮我分析其中的原因吗?
解决方案 »
- MySQL字符集的转换问题
- MYsql创建视图如何删除重复字段?
- 用脚本不能备份问题
- 菜鸟问题:关联关系设计原则
- 数据库内容更新替换问题求教?
- 啊 ?用mysqldump 备份出来的脚本(.sql文件)不考虑建表的先后顺序吗 ?
- 建表失败,原因是有个字段名为 describe 该怎么办?
- mysql 5.6 windows 绿色版本 改不了密码,创建不了数据库
- mysql中备份某一个时间段的数据
- [MySQL][ODBC 5.2(a) Driver][mysqld-8.0.11]Query execution was interrupted
- 功能实现就是在不同时段收费最后总费用
- 一次更新几十(上百)条数据,怎么进行优化,减少时间
果然后者的速度很慢,而前者很快。为什么呢,是否是因为limit a,b中的a需要大量时间去locate
关键问题不在于select里面的索引
而是在于where里面的索引
刚好你的voice_file_id在where里面
所以速度才超快