[ZODB-Dev] Indexing and dates/times

Benji York benji at benjiyork.com
Tue Jul 13 06:11:46 EDT 2010


On Tue, Jul 13, 2010 at 4:35 AM, Pedro Ferreira
<jose.pedro.ferreira at cern.ch> wrote:
> Hello,
>>> I am currently trying to devise a way to index and retrieve some
>>> millions of objects according to their modification date/time.

> So, in a relational DB i would do something like:
>
> SELECT * FROM table WHERE timestamp >= X AND timestamp <= Y
>
> Since I cannot do this with ZODB, I'd have to have a BTree, indexed by
> timestamp... however, as you said, if I want "to the second"
> granularity, I will rarely have two items with the same key (which makes
> it pretty useless).

If you use the timestamp as the key and you want to retrieve all values
between two timestamps (inclusive), you can do

    my_btree.values(min=start, max=end)
-- 
Benji York


More information about the ZODB-Dev mailing list