Skip to content
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

Performance questions #30

Closed
thecodrr opened this issue May 13, 2017 · 2 comments
Closed

Performance questions #30

thecodrr opened this issue May 13, 2017 · 2 comments
Labels

Comments

@thecodrr
Copy link

thecodrr commented May 13, 2017

As I work in performance critical environment where every millisecond counts, I have the following questions after thoroughly reading the Documentation.

  1. If I want to retrieve all the records (no filters or anything) really, really quickly what will be faster? SelectForward, SelectForwardStartsFrom with int.MinValue or SelectForwardFromTo with int.MinValue & int.MaxValue?

  2. If I understand correctly, the DBCustomSerializer serializes each object before inserting right? And deserializes each object on ObjectGet, am I right? I have observed (through performance profiling) that this takes way too much CPU as it is serializing & deserializing again and again. Is there any way to make this less CPU expensive (for example, serializing & deserializing only once or not at all?)

  3. How do I remove a record completely from the database? As I understand from the documentation, the row is just set to invisible but if I want to remove it completely, what would I have to do? (I understand this can be a performance heavy operation).

  4. Any advice regarding how to decrease the overall DB size without compromising performance?

  5. Is ObjectGetNewIdentity an expensive operation (when doing on each new insert) and if so, can it be replaced with some other alternative that is faster?

Thanks.

@hhblaze
Copy link
Owner

hhblaze commented May 15, 2017

Hi,

  1. SelectForward or SelectBackward (doesn't matter)
  2. I don't understand "serializing & deserializing again and again", if you like - store only byte[] and make your own serializations.
  3. tran.RemoveKey is the only way to delete record from the table, if you want to cut piece of data from the file you have to copy valid values to other table (Select from table1 and insert into table2), then delete completely table1 and rename table2 -> table1.
  4. Hold your batch inserts sorted (for traditional DBreeze, for object DBreeze it's included in the box) - the rest is already optimized, the only thing you can decide is either you want in concrete transaction faster update or not. In automatic updates, probably it doesn't matter, but for human interactions, when the huge batch is updated, it's possible you find that speed is not satisfactory and then you turn on "OverwriteIsNotAllowed" flag and get very fast updates paying a bit of disc space.
  5. ObjectGetNewIdentity is very fast in batch (because it selects and then inserts only once per transaction). Under the hood it reads (Select) from the table, increments and inserts into the table. This is done for the object DBreeze. Object DBreeze is a layer on top of traditional DBreeze making easier procedures of working with secondary indexes.

@hhblaze
Copy link
Owner

hhblaze commented May 17, 2017

Please, open it if you have more questions.

@hhblaze hhblaze closed this as completed May 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants