On 7 Apr 2013, at 6:56pm, Richard Hipp <[email protected]> wrote:

> It uses a btree as a priority queue.  If you have LIMIT N, then it
> initially starts putting results into the btree until the btree contains N
> entries.  Then for each additional row, it first adds the value to the
> btree, then removes the largest entry in the btree.  Hence the btree always
> holds the smallest N entries seen so far. Once all is finished, it walks
> the btree to output the results.
> 
> So with limit N, it never stores more than N results at one time.

That's neat.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to