https://stackoverflow.com/questions/71179172/what-is-the-efficient-way-to-store-key-values-in-golang
I have billions of keys of type string
and values of type HashValueList
. I am using BadgerDB to store key-value pairs. In my use case length of HashValueList
might be in millions. I have to Encode key and value in []byte
before inserting into BadgerDB; for that, I am using the encoding/gob
package. So, whenever I need value, I have to decode them again. When I get HashValueList
, I have to work on HashValue
in linear time.
Is there any better way to structure HashValue
and HashValueList
to get high read throughput from DB? And also, what is the best values Options of BadgerDB for my use case.
type HashValue struct {
Row_id string
Address string
}
type HashValueList []HashValue