I have a table that has an integer timestamp as primary key. Almost every query on this table will be of the pattern
SELECT * FROM table WHERE timestamp BETWEEN x AND y
These ranges are usually significantly smaller than the total range of stamps. Insertions happen very rarely and usually at timestamps after every other existing stamp.
Can I somehow tell my database (SQLite) to keep these entries 'sorted' and then make the selects only from the start timestamp, search through rows from there, and then stop as soon as the end timestamp has been surpassed in order to avoid having to scan the entire table and compare the value for each row? Or is this already happening?