Reputation: 31
I have a huge sqlite database with 800,000 rows and it takes a long time if the row is near the end like select * from tbl where id=578511
. This is because the query runs from the beginning of the database, but is it possible to go just directly to that row as the id equals the rowcount.
Upvotes: 1
Views: 42
Reputation: 3782
Maybe you can try to add the index of the table to make the query faster:
CREATE INDEX tbl_id ON tbl(id);
or if the data is frequently read, you can also keep them in memory.
Upvotes: 1