On Mon, Feb 17, 2014 at 2:27 PM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 17 Feb 2014, at 7:59am, Max Vlasov <max.vla...@gmail.com> wrote:
>
> > So the nanosec example modified
> >
> >     Select v-v from
> >     (
> >       Select nanosec() as v from TestTable
> >     )
> >
> > ...shows non-zero values for the current (3.8.3) and for older (3.6.10)
> > version.
>
> Erm ... that worries me a little.
>
> I don't know how SQLite handles sub-selects internally.  But the
> conventional way of doing them is a JOIN to a VIEW.  Which means that v-v
> should always equal zero.
>


Explain lit a litle light
.......
"4"    "Function"    "0"    "NanoSec(0)"
"5"    "Function"    "0"    "NanoSec(0)"
"6"    "Subtract"    "2"
"7"    "ResultRow"    "1"
"8"    "Next"    "4"
.....
So no intermediate storage probably for performance reasons. Also the
listing looks very self-explainable while possible stateful one will add
more complexity to the VDBE code.


>
> By the way, when figuring out how to optimize this still it's worth noting
> that a parameterless function is rare in SQL.  It's rarely worth optimizing
> unnamed expressions because you rarely get the same unnamed expression
> (including parameters) used twice.
>
>
Simon, I see your point, next time my test function will depend on at least
a dozen of very important parameters and will have a very, very, very long
name :)

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

Reply via email to