-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Support for batch processing #95
Comments
No plans, but I'm open to sane PRs. You can easily do batch inserts yourself by directly accessing the Badger DB: db := store.Badger()
wb := db.NewWriteBatch()
defer wb.Cancel()
for i := 0; i < N; i++ {
err := wb.Set(key(i), value(i), 0) // Will create txns as needed.
handle(err)
}
handle(wb.Flush()) // Wait for all txns to finish. |
Thanks for the reply. What I understood so far is that, if I have to use the batch of badger DB, then I have to write wrapper for gob and indexing in my code, same as badgerhold DB. |
Ah, in that case, if you want to make use of the indexing, then yeah, you'd either need to duplicate what I'm doing in BadgerHold. |
Looking further at how WriteBatch is implemented, I'm not sure of a good way to allow this. WriteBatches don't support iterators, and iterators are needed to lookup indexes, so the only way I'd be able to support indexing and WriteBatches is to manage the indexes outside of the WriteBatch transaction, which would mean dirty reads / possibly corrupted data. |
Are there any plans to add batch insertion in badgerhold?
The text was updated successfully, but these errors were encountered: