Skip to content

What is the best practice to do persistence? #77

Answered by edwinkys
Catstyle asked this question in Q&A
Discussion options

You must be logged in to vote

You are actually right!

I tested the code you provided againts the optimal way to do persistence and they produce totally different result:
https://colab.research.google.com/drive/1bCOa0e6F8eZvRVo89h5CXp66V9438K4y?usp=sharing

This is the most storage optimal way to save a collection.

from oasysdb.prelude import Vector, Config, Database, Collection, Record

db = Database("test")
config = Config.create_default()
collection = Collection(config)

for idx in range(300):
    # do some actual work and save collection every 100 objects
    # just use Random instead
    records = Record.many_random(dimension=512, len=100)
    collection.insert_many(records)
    # db.save_collection("storage", coll…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@Catstyle
Comment options

@edwinkys
Comment options

Answer selected by edwinkys
Comment options

You must be logged in to vote
3 replies
@Catstyle
Comment options

@Catstyle
Comment options

@edwinkys
Comment options

Comment options

You must be logged in to vote
1 reply
@Catstyle
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Any question or suggestion
2 participants