-
Notifications
You must be signed in to change notification settings - Fork 2
New virtual index #17
base: master
Are you sure you want to change the base?
Conversation
e61e648
to
ed5c03f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
func newIndex(builder Indexable, prefix byte, indexer *Indexer) *MultiKeyIndex { | ||
// NewVirtualIndex provides an index API on top of a natural key table. The use case is | ||
// a combined natural key where the first element has a fixed size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would you do if the first element doesn't have a fixed size? Is there a way you could use the max 255 dynamic length codec with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a fixed size we would easily get overlapping results in a prefix scan. We may be able to filter them out with a custom iterator on "simple natural" keys but this is a very special use case.
The one I wanted to cover was a natural key starting with the groupID so that we can have a typed index:
idx := AsUInt64Index(NewVirtualIndex(builder))
without extra costs.
It is a bit hard for me to argue for the one or the other as #16 is not completely clear to me. I can see how it moves the This Virtual index is based on mostly existing components and logic. In combination with the |
@alpe let's chat about this live next time we get a chance. I want to understand this approach better and think about how it addresses the needs of say that |
Add a new index type on top of a natural key table.
Resolves #16 with a different approach