Sorry for the late reply. On Fri, Apr 10, 2015 at 11:11 AM, Thomas Mueller < [email protected]> wrote:
> A workaround is to change the query slightly, to do the caching yourself, > for example: > > > SELECT name, @dist as dist FROM ( > SELECT name, DISTANCE(name, 'alex') as dist > FROM Person > ) > WHERE (@dist := dist) > 0.05 > ORDER BY dist DESC > LIMIT 5; > Your suggestion seemed very convoluted at first, but then I realized I could simplify it thus: SELECT name, @dist as dist FROM Person WHERE (@dist := DISTANCE(name, 'alex')) > 0.05 ORDER BY dist DESC LIMIT 5; Seems to work fine. The nested query doesn't seem to be required. If there is some subtle difference between the two, please let me know. thanks, -- *Harshad RJ <http://lavadip.com>* -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
