rosedblabs / rosedb

Lightweight, fast and reliable key/value storage engine based on Bitcask.
https://rosedblabs.github.io
Apache License 2.0
4.58k stars 632 forks source link

Proposal: allow key and value to store per bucket #289

Open 0x5487 opened 1 year ago

0x5487 commented 1 year ago

Scenario: A bucket is just like a table in a database or a collection in MongoDB. A system has 10 million more records (order) in DB. If we need to find all orders for a user. we probably need to iterate keys to get it. The Get function might be slower in this case.

Proposal: allow specific a bucket when calling "Put" and "Get" functions. Each bucket has its own index.

func (db *DB) Put(bucket string, key []byte, value []byte) error
func (db *DB) Get(bucket string, key []byte) ([]byte, error)

Unfortunately, this proposal needs to change the record format in the WAL file.

roseduan commented 10 months ago

I will consider this feature.