On Sun, Nov 3, 2013 at 4:09 AM, Emmanuel Lécharny <elecharny@gmail.com> wrote:

today, I investigated the way the Mavibot Partition is implemented, wrt
to the modifications I've made those past month. There are a few missing
parts, I'm afraid.

First of all, we aren't counting correctly. When we add a <key, value>
tuple, we should increment the counter regardless the fact the key
exists or not. In other words, we count tuples, not keys. That's easy to

I think we should count the tuples, say we have a filter

and 'cn' index has: x -> 1,2,3,4,5,6,7
'sn' index has: y -> 2,5

then the optimizer will pick up the predicate with less number of candidates
which is 'sn' here based on the count of tuples, if we count only keys
then this optimization will not work
A bit more complex : when we create a cursor on top of an index, we
should be able to browse all the tuples back and forth. That means we
should iterate over the keys, and over the values for each key if we
have more than one. It requires some modifications in the way we have
implemented the MavibotCursor. Typically, we have to retain the position
in the BTree, *and* the position in the values associated with the key
we are processing. Currently, it does noy work well.

I'm going to get it fixed.

Thanks for any comment on those findings.

Emmanuel Lécharny

Kiran Ayyagari