datalevin

Stephen Castro-Starkey 2025-01-31T13:12:58.282949Z

Hi! I just stumbled across datalevin when I was researching kv databases and was impressed! Trying to figure out some design principles and wondering -- just how many tables can be open at once using open-dbi? If, for example, I wanted each "event stream" to be modeled as its own table, and users could create their own arbitrary event stream, would I hit any unexpected limits? Also, since there is no with-open-dbi I'd have to open them all and leave them open. Is that accurate? Sorry for the newbie questions. 🙂 I'm also happy to have a single table and figure out some kind of compound key structure, but the feature seemed too good to be true so I figured I'd ask!

Stephen Castro-Starkey 2025-02-04T12:40:14.577699Z

Thanks for the advice!

Huahai 2025-02-01T05:19:17.095649Z

• how many tables: set when open-kv with option :max-dbs, default is 128. Keep in mind that dbis are search in a linear order, so you don't want to have too many of them.

Huahai 2025-02-01T05:21:04.729689Z

correct, keep open-dbi open is fine.

Huahai 2025-02-01T05:21:17.315539Z

also, no need to close them either

Huahai 2025-02-01T05:22:23.921279Z

compound key is supported, you can use tuples, basically, [k1 k2 k3...] as long as the total length of these keys are not over the key size limit, which is 511 bytes.

Huahai 2025-02-01T05:25:28.312219Z

the tuple keys could be of the same type (homogeneous tuple), or different type (heterogeneous tuple).

Huahai 2025-02-01T05:27:13.367769Z

no single tuple key can be longer than 255 bytes though