On Mon, Feb 17, 2014 at 7:00 PM, RSmith <rsm...@rsweb.co.za> wrote: > > > On 2014/02/17 09:59, Max Vlasov wrote: >> >> ..... >> So >> >> Select nanosec() - nanosec() from ... >> >> returns non-zero values for most of the times, so there's no guarantee the >> user functions or any other functions will be called once for the step.//... >> etc. > > > Did you mark your nanosec function as SQLITE_DETERMINISTIC > <http://www.sqlite.org/c3ref/c_deterministic.html>? > http://www.sqlite.org/c3ref/create_function.html > > Which, if not, it can and will very much return non-zero values. >
Very interesting option, it did affected the results, they're now zero for both cases. Also I see this quite a young option listed as a new feature of 3.8.3. "Added SQLITE_DETERMINISTIC as an optional bit in the 4th argument to the sqlite3_create_function() and related interfaces, providing applications with the ability to create new functions that can be factored out of inner loops when they have constant arguments" So the query with this option Select nanosec() as v from TestTable where v<>v always returns empty dataset. But it seems this option still has something to explain since Select nanosec() - nanosec() from TestTable returns always zeros while Select nanosec(), nanosec() from TestTable returns different values for fields Either nanosec() - nanosec() is much faster than the granularity of performance counter on average windows hardware or they are different cases for some reasons. Max _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users