On Oct 13, 2005, at 5:11 PM, Oleg Broytmann wrote: > On Sun, Oct 09, 2005 at 05:49:33PM -0400, David Binger wrote: >> On Oct 9, 2005, at 4:51 PM, Oleg Broytmann wrote: >>> Can I have a serial (autoincremented) counter? Should I? They >>> are useful >>> in cases when I don't have an interesting distinguishing features >>> in my >>> objects. For example, if I want to store a list of FTP servers I can >>> distinguish them by their URLs; hence I can use URLs as indices. >>> But if I >>> want to store access_log elements - there are no such distinguishing >>> elements. Even the full tuple (time, client IP, URL) can occur many >>> times >>> (many concurrent queries from a program like ApacheBenchmark; or a >>> huge >>> network behind a NAT with a single external IP). Autoincremented >>> counter >>> seems to be the best way to generate names (indices). >> >> I think I would do that as a BTree whose values are Persistent >> instances with a single "int" attribute. > > Keys, not values? Or I've missed something important here... To deal with this I just have each container keep its own item counter, and that is the value of each item's id. This assumes that each item belongs to a container... In addition to that, I can define a unique index (or several) if and whenever they make sense. The value I use for the keys of that index, is a tuple of values -- and such values may also of course be persistent items. mario