简体   繁体   中英

SQLite SELECT with Limit performance

I have an android app that performs a SELECT * statement over a DB with ~5M records. The query takes about 1 minute to complete and I was wondering whether it can be speed up by using indexes or something else.

SELECT * FROM [TABLE] where timestamp > [TIMESTAMP] ORDER by timestamp ASC LIMIT 0,500

此查询中的查找和排序都可以通过timestamp列上的索引来加速:

CREATE INDEX table_timestamp_index ON [TABLE](timestamp);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM