On 10/30/17, Wout Mertens <[email protected]> wrote: >> WHERE STRFTIME('%Y-%m-%d %H:%M', timestamp) = STRFTIME('%Y-%m-%d %H:%M', > 'now', 'localtime', '-1 minute'); > > Won't this run strftime on all rows? Unless you have a calculated index on > that strftime function, I think you should convert the 'now' to a timestamp… >
The first STRFTIME() does run for every row, because timestamp is different for every row. But the second STRFTIME() should be factored out and run only once. Please verify that this is happening by looking at the output of EXPLAIN, and report the problem to me if you find out otherwise. -- D. Richard Hipp [email protected] _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

