Re: [sqlite] Partial index to find maximum

2014-12-29 Thread Clemens Ladisch
Hick Gunter wrote: >create the primary key index ordered properly > >CREATE TABLE t (..., PRIMARY KEY ( a ASC, b DESC)...); DESC is not necessary here; SQLite has no problem reading the index in reverse order, if needed. (DESC in an index is useful only when you want to optimize multiple ORDER BY

Re: [sqlite] Partial index to find maximum

2014-12-29 Thread Hick Gunter
: Montag, 29. Dezember 2014 09:34 An: General Discussion of SQLite Database Betreff: [sqlite] Partial index to find maximum Hi, I have a table with a 2 column PK, say 'a' and 'b'. I need to find, for a given value of 'a', the highest matching 'b'. The query

Re: [sqlite] Partial index to find maximum

2014-12-29 Thread Keith Medcalf
..@sqlite.org] On Behalf Of Baruch Burstein >Sent: Monday, 29 December, 2014 01:34 >To: General Discussion of SQLite Database >Subject: [sqlite] Partial index to find maximum > >Hi, > >I have a table with a 2 column PK, say 'a' and 'b'. I need to find, for a &g

Re: [sqlite] Partial index to find maximum

2014-12-29 Thread Mohit Sindhwani
On 29/12/2014 4:33 PM, Baruch Burstein wrote: Hi, I have a table with a 2 column PK, say 'a' and 'b'. I need to find, for a given value of 'a', the highest matching 'b'. The query itself it simple: SELECT max(b) FROM t WHERE a=:whatever To speed this up, I would add an index on 'a'. Now,

[sqlite] Partial index to find maximum

2014-12-29 Thread Baruch Burstein
Hi, I have a table with a 2 column PK, say 'a' and 'b'. I need to find, for a given value of 'a', the highest matching 'b'. The query itself it simple: SELECT max(b) FROM t WHERE a=:whatever To speed this up, I would add an index on 'a'. Now, the question is is there some way to tell the ind