I have a SQLite table created in a manner something like this:
CREATE TABLE ex2(_ID INTEGER PRIMARY KEY AUTOINCREMENT,x REAL,y REAL,z TEXT);
My query against this table, will always be:
SELECT z FROM ex2 WHERE x BETWEEN 1.5 AND 100.5 AND y BETWEEN 10.2 AND 65.3;
My query asks for results satisfying a range constraints for the x and y column values (REAL data type). Also just to clarify, 1.5,100.5, 10.2 and 65.3 are not fixed. Just to illustrate a sample query.
x and y column values are NOT going to be unique for sure.
What is the best way to create the index(es)? My options (and testing so far):
Option 1:
CREATE INDEX ex2i1 ON ex2(x);
CREATE INDEX ex2i2 ON ex2(y);
Options 2:
CREATE INDEX ex2i12 ON ex2(x,y);
I have done some (crude) performance tests on my Android test device, and I can't seem to find a concrete proof on which index is actually better.