I'd like to do analytics on a large table (10,000,000 rows / 40 columns). So I've loaded the table into SQLite to query it. I have a query like
SELECT x, y FROM table WHERE x in (10,20,30)
Now I've noticed that this is incredibly slow in SQLite, since I have an index on x
only. I guess this is due to hard-drive access which jumps between different places in the file. A covering index (x, y)
would solve the issue, but I don't want to create a covering index for every type of query I do.
So my question is: Can I tune SQLite to be faster? Or alternatively which database is likely to be faster than my solution (are other SQL DBs faster)?
PS: What's the actual reason the query is so slow?