[sqlite] Multiple Column index

2016-02-22 Thread Rowan Worth
On 22 February 2016 at 17:07, Michele Pradella wrote: > CREATE INDEX indexAB ON test(DateTime,CarPlate); CREATE INDEX indexA ON test(DateTime); > So if I have a query like this >>> "SELECT * FROM table_name WHERE DateTime>> DateTime>VALUE_MIN" >>> >> > Generally speaking,

[sqlite] Multiple Column index

2016-02-22 Thread Michele Pradella
> On 22 Feb 2016, at 9:07am, Michele Pradella > wrote: > >> Already done this check. My last question was about to reduce the number of >> indexes on table avoiding kill a "quite unnecessary" index that if used do a >> better job that the other. >> Generally speaking, I think that if you use a

[sqlite] Multiple Column index

2016-02-22 Thread Michele Pradella
>>> Your indexes are badly designed. >>> >>> You require the following two indexes: >>> CREATE INDEX indexAB ON test(DateTime,CarPlate); >>> CREATE INDEX indexBA ON test(CarPlate,DateTime); >>> >>> The indexes: CREATE INDEX indexA ON test(DateTime); CREATE INDEX indexB ON test(CarPlate);

[sqlite] Multiple Column index

2016-02-22 Thread Michele Pradella
; that query have to do if we use indexAB instead index? > >> -Original Message- >> From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users- >> bounces at mailinglists.sqlite.org] On Behalf Of Michele Pradella >> Sent: Friday, 19 February, 2016 01:07

[sqlite] Multiple Column index

2016-02-22 Thread Simon Slavin
On 22 Feb 2016, at 9:07am, Michele Pradella wrote: > Already done this check. My last question was about to reduce the number of > indexes on table avoiding kill a "quite unnecessary" index that if used do a > better job that the other. > Generally speaking, I think that if you use and index

[sqlite] Multiple Column index

2016-02-22 Thread Simon Slavin
On 22 Feb 2016, at 8:39am, Michele Pradella wrote: >> Your indexes are badly designed. >> >> You require the following two indexes: >> CREATE INDEX indexAB ON test(DateTime,CarPlate); >> CREATE INDEX indexBA ON test(CarPlate,DateTime); >> >> The indexes: >>> CREATE INDEX indexA ON test(DateTi

[sqlite] Multiple Column index

2016-02-19 Thread Quan Yong Zhai
I supposed your SQL command like this "select * from table where (DateTime>X AND DateTimeX AND DateTimemailto:michele.pradella at selea.com> : ?2016/?2/?19 16:06 ???: sqlite-users at mailinglists.sqlite.org<mailto:sqlite-users at mailinglists.sqlite.org> ??:

[sqlite] Multiple Column index

2016-02-19 Thread Simon Slavin
On 19 Feb 2016, at 10:34am, Michele Pradella wrote: > Ok but the question is: can a statement (SELECT * FROM table WHERE (field1 > LIKE 'TEXT%')AND(field2>=X)AND(field2<=Y)) use the index created on > multicolumn field1,field2? or I use it only if I have file1 IN,=,IS? > Which is the best ind

[sqlite] Multiple Column index

2016-02-19 Thread Clemens Ladisch
Michele Pradella wrote: >> Michele Pradella wrote: >>> so there's no way to use that kind of double column index on a select like >>> explain query plan select * from test where (CarPlate LIKE 'AA000%') AND >>> (DateTime>1); >>> because at least one field have to do with operator = correct? >> >>

[sqlite] Multiple Column index

2016-02-19 Thread Michele Pradella
> (please don't top-post) > > Michele Pradella wrote: >> so there's no way to use that kind of double column index on a select like >> explain query plan select * from test where (CarPlate LIKE 'AA000%') AND >> (DateTime>1); >> because at least one field have to do with operator = correct? > No,

[sqlite] Multiple Column index

2016-02-19 Thread Clemens Ladisch
(please don't top-post) Michele Pradella wrote: > so there's no way to use that kind of double column index on a select like > explain query plan select * from test where (CarPlate LIKE 'AA000%') AND > (DateTime>1); > because at least one field have to do with operator = correct? No, the number

[sqlite] Multiple Column index

2016-02-19 Thread Michele Pradella
because at least one field have to do with operator = correct? no can be one of = or IN or IS but not LIKE operator Selea s.r.l. Michele Pradella R&D SELEA s.r.l. Via Aldo Moro 69 Italy - 46019 Cicognara (MN) Tel +39 0375 889091 Fax +39 0375 889080 *michele.pradella at selea.c

[sqlite] Multiple Column index

2016-02-19 Thread Michele Pradella
Ok understand, so there's no way to use that kind of double column index on a select like explain query plan select * from test where (CarPlate LIKE 'AA000%') AND (DateTime>1); because at least one field have to do with operator = correct? Selea s.r.l. Michele Pradella R&D SE

[sqlite] Multiple Column index

2016-02-19 Thread Clemens Ladisch
Michele Pradella wrote: > CREATE TABLE test (DateTime BIGINT,CarPlate VARCHAR(255)); > CREATE INDEX indexA ON test(DateTime); > CREATE INDEX indexB ON test(CarPlate); > CREATE INDEX indexAB ON test(DateTime,CarPlate); > > EXLPAIN QUERY PLAN SELECT * FROM test WHERE (DateTime>1)AND(DateTime<100) AND

[sqlite] Multiple Column index

2016-02-19 Thread Keith Medcalf
rg > Subject: [sqlite] Multiple Column index > > Hi all, I have a question about using index with multiple column. > Take this test case > CREATE TABLE test (DateTime BIGINT,CarPlate VARCHAR(255)); > CREATE INDEX indexA ON test(DateTime); > CREATE INDEX indexB ON test(CarPlate

[sqlite] Multiple Column index

2016-02-19 Thread Michele Pradella
Hi all, I have a question about using index with multiple column. Take this test case CREATE TABLE test (DateTime BIGINT,CarPlate VARCHAR(255)); CREATE INDEX indexA ON test(DateTime); CREATE INDEX indexB ON test(CarPlate); CREATE INDEX indexAB ON test(DateTime,CarPlate); now if you do [1] -> EXLPA

[sqlite] Multiple Column index

2016-02-19 Thread Hick Gunter
s.sqlite.org Betreff: [sqlite] Multiple Column index Hi all, I have a question about using index with multiple column. Take this test case CREATE TABLE test (DateTime BIGINT,CarPlate VARCHAR(255)); CREATE INDEX indexA ON test(DateTime); CREATE INDEX indexB ON test(CarPlate); CREATE INDEX index