My Android application has an activity to present data from SQLite database. The db table might contain huge number of rows. For performance reasons, I want to load 20 rows from db at a time, and when user scrolls down listview to the end, read next 20 rows.
So I want to use SQL statement like this:
select * from mytable where id > N and count = 20;
I just wonder if SQLite supports this kind of "count=20"
feature to read at maximum 20 rows for the query. If it is supported, what is exact syntax?
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `mytable` ADD INDEX `mytable_idx_count_id` (`count`,`id`);
SELECT
*
FROM
mytable
WHERE
mytable.id > mytable.N
AND mytable.count = 20