Re: [sqlite] optimizing min/max with calculated index?

2017-10-30 Thread Wout Mertens
Works great for me! On Thu, Oct 26, 2017 at 10:13 PM Richard Hipp wrote: > Y'all please try the lastest trunk version of SQLite for me and let me > know if it works better for you. Thanks. > > -- > D. Richard Hipp > d...@sqlite.org > ___ sqlite-users

Re: [sqlite] optimizing min/max with calculated index?

2017-10-26 Thread Richard Hipp
Y'all please try the lastest trunk version of SQLite for me and let me know if it works better for you. Thanks. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin

Re: [sqlite] optimizing min/max with calculated index?

2017-10-26 Thread Jens Alfke
> On Oct 26, 2017, at 6:11 AM, Richard Hipp wrote: > >> Is this an optimization opportunity for calculated indexes? > > It is. There is a min/max optimization to deal with this situation, > but it currently does not know about indexes on expressions. +1. The project I work on (Couchbase Lit

Re: [sqlite] optimizing min/max with calculated index?

2017-10-26 Thread Richard Hipp
On 10/26/17, Wout Mertens wrote: > I have a table with an indexed json field, and I want to know the maximum > value of that field. > > create table events(id integer primary key, json JSON); > create index t on events(json_extract(json, '$.ts)); > > If I do > > select max(json_extract

[sqlite] optimizing min/max with calculated index?

2017-10-26 Thread Wout Mertens
I have a table with an indexed json field, and I want to know the maximum value of that field. create table events(id integer primary key, json JSON); create index t on events(json_extract(json, '$.ts)); If I do select max(json_extract(json, '$.ts')) from events; it does a table sca