On 10/4/17, sub sk79 <subs...@gmail.com> wrote:
> On Wed, Oct 4, 2017 at 12:29 PM, Richard Hipp <d...@sqlite.org> wrote:
>> This restriction on the query flattener causes your example
>> query above to do what you want.
> If subquery-flattening needs to be disabled explicitly, is using "LIMIT -1
> OFFSET 0 " the recommended way?

Just LIMIT -1 is sufficient.

>> SQLite version 3.21.0 adds new restrictions on the query flattener
>> which allows the application to control whether expensive functions
>> (or subqueries) are run before or after sorting.
> Is 'expensive' going to be a flag in fourth parameter to create_function

No.  "expensive_function()" is just a place-holder.  It might be a
large expression, involving one or more subquery expressions, or it
might be something that uses a lot of memory rather than a lot of CPU
cycles.  That is part of the problem of why the query planner has such
a hard time determining whether or not to make this optimization
automatically - it is difficult to pin down what the application is
likely to think is "expensive".
D. Richard Hipp
sqlite-users mailing list

Reply via email to