On Tuesday, 14 January, 2020 09:23, Simon Slavin <slav...@bigfraud.org> wrote:

>Would it be possible to phrase your SELECT as a SELECT with a sub-SELECT
>?  Have the sub-SELECT figure out which rows you want in which order,
>then use a SELECT to apply your UDF to them ?  It is guaranteed that the
>sub-SELECT is processed before the SELECT.

you mean if you do something like this:

select *
  from (
         select *
           from ...
          where ...
       )
 where ...

?

If the query flattener is operating the optimizer will push the outer where 
condition into the inner query after which there is no guarantee that the 
conditions in the outer query will be processed *after* the conditions in the 
inner query, especially not if the pushed terms are estimated to reduce the 
number of candidates "quicker" by executing it sooner.

I seem to recall something about "expensive" conditions that will be forced to 
be run on only as few surviving candidate rows as possible, but my recollection 
is vague (they say the memory is the second thing to go -- strange I can't 
remember the first).

Anyway, Richard may be able to help here.

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to