[FR] Bit index on json property support
Thank you very much for the great project. Right now I have json document which has some low-cardinality columns like ‘status_code’, it ideal bit index usecase. ( its very common for a status property in a row/ json document). Can we have bit index type in bunts?
I'd need more information about how you see this feature working. What is the range of the bit index, is it just 0 and 1? Maybe an example of how you foresee it working in code.
I'd need more information about how you see this feature working. What is the range of the bit index, is it just 0 and 1? Maybe an example of how you foresee it working in code.
thank your quick response very much! here is main part of the json(Order)
`json
{ "orderId": "ORD123456789", "customerId": "CUST98765", "orderDate": "2023-10-27T10:30:00Z", "status": "processing", "totalAmount": 274.99, "currency": "USD", "shippingAddress": { "street": "123 Tech Lane", "city": "Gadgetville", "state": "CA", "zipCode": "90210", "country": "USA" }, "lastUpdated": "2023-10-27T11:05:00Z" }
`
"status": "processing", stands for a order status, the valid values are enum as
- "Confirmed"
- "Canceled"
- "Processing"
- "Deliveryed"
my app's persistent layer is built with buntdb and sqlite. memroy usage is crital for my app. I propose 'bit index' mainly want to reduce memroy usage of buntdb, as almost every a business model has one or more status like columns, and those status columns are always used in query criteria. (generaly speaking low-cardinality is ideal for bit index and use less memroy compare to btree index)
here is a evaluation btree vs bit index on status gemini . 😄 (just for reference)
if the evaluation from AI is ture , so for the case an app has more models have such status column, a bit index will save more memory usage.
thank you again!
I'd need more information about how you see this feature working. What is the range of the bit index, is it just 0 and 1? Maybe an example of how you foresee it working in code.
ideally, if it feasible , the expecte API something like this
`go
type BitValue interface { int | string | boolean }
func IndexJsonBit[T BitValue](path string) func(a, b BitValue) bool
`
as right now buntdb's indexing function does not support generic, so we can break above generic method to 3 different method(strightforward)
`go
func IndexJsonBitString(path string) func(a, b String) bool
func IndexJsonBitInt(path string) func(a, b int) bool
func IndexJsonBitBool(path string) func(a, b bool) bool
`