[bknr-devel] Fwd: searching intervals, sorting and invalid-store-random-state signaled when opening a store

Hans Hübner hans.huebner at gmail.com
Fri May 7 07:58:11 UTC 2010


On Wed, May 5, 2010 at 16:46, madnificent <madnificent at gmail.com> wrote:

> With respect to the indices, can a skiplist return a range of objects?
>  Or would it be best to do that by mapping over the objects in the
> index?  (eg: show the posts for a particular user if there'd be an
> index on post-date).  If there currently isn't anything like this:
> Have you thought about this and found it useless or would it be a good
> thing to have?  Have you thought about a syntax which you'd prefer for
> sorted results?

I usually do not use indices for such applications, but rather collect
the data into the right objects when it is created.  In your
application, every user object would contain a list of posts that the
user made, propably sorted by reverse post date or similar.  To read
all posts made by a particular user in a certain time period, the post
list would just be scanned.  Given that the number of posts per user
is relatively small, there is not much to be gained by an index.

Indices make sense when you have a very large database that can't be
meaningfully split into smaller pieces in advance.  The ID slot of
persistent objects is such a case.  I also successfully used indices
to organize access to 2D data that is access by geocoordinates.

Note that often, you can achieve a better design when you abandon the
idea of indices as being a service of the database and instead think
about the data structures that you want to use to organize your data.
With traditional, disk based databases, indices are complementary to
storage and often form the architectural foundation for the database.
With the bknr datastore, indices play a more specific role inside the
storage layer and often offer no advantage when (ab-)used to build the
application.

Let me know if you still think that you want to use store indices.  I
may come up with an example how a skip list could be used, but it is
not entirely straightforward.

-Hans




More information about the Bknr-devel mailing list