← Back to team overview

zeitgeist team mailing list archive

Re: [Merge] lp:~zeitgeist/zeitgeist/bluebird-no-distinct into lp:zeitgeist

 

>From #sqlite:
-----------------------------------------------
<RainCT> Hi. I've got a question: do .step() calls (internally) just look for the next row, or does the first .step() call already process everything?
<RainCT> Particularly, I'm wondering if removing a LIMIT from a query and instead aborting the while(... stmt.step() ...) once I've got enough will have any bad side effect
<#sqlite_guy> RainCT: technically, each step is actually executing code on the internal VM
<#sqlite_guy> I would say that if it makes sense to put in a LIMIT, then do so
<RainCT> #sqlite_guy: the problem is that the limit depends on another condition (a DISTINCT), but having SQLite check that makes the query 100x slower
<#sqlite_guy> how messy is the distinct?
<#sqlite_guy> could you throw an appropriate index on?
<RainCT> and I can really easily check that condition in code and count the number of things I got myself
<#sqlite_guy> honestly, you're up in the realm of personal taste/whatever works
<RainCT> #sqlite_guy: it's basically an integer ID which may be the same for a few consecutive rows
<RainCT> #sqlite_guy: Okay, thanks :). On benchmarks it seems to work fine, but I just wanted to make sure I'm not missing something.
<#sqlite_guy> nah
<#sqlite_guy> you're not missing anything
<#sqlite_guy> just make sure to hit sqlite3_reset when you're done with it
<#sqlite_guy> or finalize, obviously
-----------------------------------------------
-- 
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird-no-distinct/+merge/87175
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~zeitgeist/zeitgeist/bluebird-no-distinct into lp:zeitgeist.


References