select COUNT(*) from SHTwflFault_Info where (endStn_id = 2 and Act_Time_sec > 1318212419 and Act_Time_sec < 1381370820) or (startStn_id = 2 and Act_Time_sec > 1318212419 and Act_Time_sec < 1381370820) GROUP BY FltLine_id
select FltLine_name, FltLine_lev, COUNT(*) AS nums from SHTwflFault_Info where (endStn_id = 2 and Act_Time_sec > 1318212419 and Act_Time_sec < 1381370820) or (startStn_id = 2 and Act_Time_sec > 1318212419 and Act_Time_sec < 1381370820) GROUP BY FltLine_id LIMIT 0, 200
上面两句都执行的很慢,要怎么改或创建索引加快速度呢?QQ:601367847
sqlite3数据库查询、索引
答案:2 悬赏:80 手机版
解决时间 2021-02-07 13:12
- 提问者网友:杀手的诗
- 2021-02-06 22:00
最佳答案
- 五星知识达人网友:三千妖杀
- 2021-02-06 23:34
select COUNT(*)
from SHTwflFault_Info
where Act_Time_sec > 1318212419 and Act_Time_sec < 1381370820
and (startStn_id = 2 or endStn_id = 2)
group by FltLine_id可以在Act_Time_sec上建索引
第2个sql同第1个,只是后面多了个limit
from SHTwflFault_Info
where Act_Time_sec > 1318212419 and Act_Time_sec < 1381370820
and (startStn_id = 2 or endStn_id = 2)
group by FltLine_id可以在Act_Time_sec上建索引
第2个sql同第1个,只是后面多了个limit
全部回答
- 1楼网友:醉吻情书
- 2021-02-07 00:49
之前学android开发的数据库时候,用过sqlite3,这是项目里面的一段sql代码,你参考一下
create table moban (_id integer primary key autoincrement,
moban_name varchar(40) not null,
moban_cost numeric(7,2) not null default 0.00,
moban_shouzhi int default 0,
moban_delete int not null default 0
moban_beizhu varchar(40) )
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯