Re: iterate BTRee in reverse

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <CAPDm-FjH3L28PapcjgMEO6yZF-kLAwC=MME3N89gKEd43VT=_Q@mail.gmail.com>
On Tue, Dec 6, 2016 at 2:29 AM, Sanjay Rao <[email protected]> wrote:

> Is it possible to iterate BTree in reverse order without iterating it's
> all keys ?
>

Yes and no.  You can used reversed() with keys(), but under the hood, the
BTree has to iterate over all of the buckets to get the length and to
traverse backward between buckets, so the entire BTree ends up getting
loaded.

Jim

-- 
Jim Fulton
http://jimfulton.info

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.