What is the maximum IBTree key my system can use?

20 views
Skip to first unread message

Éloi Rivard

unread,
Jan 8, 2019, 10:12:22 AM1/8/19
to zodb
Hi.
IOBTree()[(2**32)-1] = True is raising a TypeError on my computer, and in fact it seems the maximum key I can use is 2**31-1
  • Is there a constant somewhere indicating the maximum key I can use in a IOBTree? I found that IBTreeFamily implements a maxint parameter, but how can I know which family I am using?
  • Is the maximum value the same for everyone? If no, how could I increase this value?
  • Also, what are your thoughts on 128-bit support?

Thank you!
Éloi Rivard


Sean Upton

unread,
Jan 8, 2019, 11:15:49 AM1/8/19
to Éloi Rivard, zodb
BTrees.family64.IO.BTree is the same as BTrees.LOBTree — either spelling ouught to do what you need.

Pick integer values for keys between BTrees.family64.minint and  BTrees.family64.maxint.

Why do you need 128-bit support?  If you want to use UUIDs as keys, use an OOBTree, or possibly a composition of pair of LOBTrees (one for UUID string to long index, one for long to object).

Sean

--
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 zodb+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Éloi Rivard

unread,
Jan 8, 2019, 12:09:41 PM1/8/19
to zodb
Pick integer values for keys between BTrees.family64.minint and  BTrees.family64.maxint.

This code raises TypeError: integer out of range
IOBTree()[BTrees.family64.maxint-1] = True

Why do you need 128-bit support?  If you want to use UUIDs as keys, use an OOBTree, or possibly a composition of pair of LOBTrees (one for UUID string to long index, one for long to object).

So this one is another problem. As it is written in the bug report, "the BTrees documentation advises that we can also use data structures specialized to integers, which are faster and use less memory", so I would prefer to use a LOBTree than an OOBTree.

Sean Upton

unread,
Jan 8, 2019, 12:53:57 PM1/8/19
to Éloi Rivard, zodb
On Jan 8, 2019, at 10:09 AM, Éloi Rivard <azm...@gmail.com> wrote:
This code raises TypeError: integer out of range
IOBTree()[BTrees.family64.maxint-1] = True

You are using the wrong class.  Try LOBTree explicitly, not IOBTree.

So this one is another problem. As it is written in the bug report, "the BTrees documentation advises that we can also use data structures specialized to integers, which are faster and use less memory", so I would prefer to use a LOBTree than an OOBTree.

Then use an LOBTree, and use 64-bit (C long long) integers.  It is not unreasonable to suggest that you do not need 128 bit keys.

Sean

Éloi Rivard

unread,
Jan 8, 2019, 1:48:16 PM1/8/19
to Sean Upton, zodb
You are using the wrong class.  Try LOBTree explicitly, not IOBTree.
Ok I can manage to use LOBTree instead of IOBTree. Some 'minint' and 'maxint' constants attached to the every kind of trees would be useful though.
 

Then use an LOBTree, and use 64-bit (C long long) integers.  It is not unreasonable to suggest that you do not need 128 bit keys.
 
As it is written in the bug report, my company has a lot of data identified with UUID4. At the moment we cannot consider to use another data type if it is not bijectionnal with UUID4. UUID4 can be transformed to int128, and generated from a int128 so we could use int128 instead of UUID4. However this is not possible with int64. We could use LOBTree if it supported 128int, in the meantime we use OOBTrees.
Reply all
Reply to author
Forward
0 new messages