On 2 Feb 2019, at 10:19pm, Gerlando Falauto <[email protected]> wrote:
> SELECT source1, source2, ts, value
> FROM rolling
> WHERE source1 = 'aaa'
> AND ts > 1 AND ts < 10;
>
> [...snip...]
> So I add an extra ORDER BY clause:
Concentrate on the results you want. Don't try to 'game' the library. You
don't understand how it thinks, and nor do I. Do you want the things in a
certain order ? If not, don't ask for it.
To find the best results for the above query,
1) Put a typical amount of typical data into the table
2) Create two indexes:
first index (source1, ts)
second index (ts, source1)
3) Execute the command ANALYZE.
4) Execute the query you actually want (presumably without ORDER BY) using
EXPLAIN QUERY PLAN.
Find what it does and get back to us.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users