2016-10-16 21:05 GMT+02:00 Keith Medcalf <kmedc...@dessus.com>:
> See https://www.sqlite.org/optoverview.html
> under section 10.0 Query Flattening
> Your query is:
> SELECT * FROM <view> WHERE <condition>
> which could be treated as
> SELECT *
> FROM (view select statement)
> WHERE condition
> and then flattened. Note however that the query WILL NOT be flattened
> because of rule #2, the subselect in the FROM clause contains an aggregate ...
OK, I understand. The query is mostly run in a cron job. So I think I
go for the ‘expensive’ one, because that is more clear.
>> -----Original Message-----
>> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
>> On Behalf Of Jens Alfke
>> Sent: Sunday, 16 October, 2016 12:17
>> To: SQLite mailing list
>> Subject: Re: [sqlite] Why takes the second SELECT three times as much
>> > On Oct 16, 2016, at 4:49 AM, Luuk <luu...@gmail.com> wrote:
>> > Because your second query has to build the complete view before it can
>> decide if a result is between the selected dates?
>> I didn’t think a view had a physical manifestation that had to be built; I
>> thought it was just a shortcut/macro for a nested SELECT statement.
>> Or is the query optimizer not able to convert the nested SELECT into the
>> same form as the first query?
>> sqlite-users mailing list
> sqlite-users mailing list
sqlite-users mailing list