Verified Commit cf19d53e authored by Aral Balkan's avatar Aral Balkan
Browse files

Improve explanation of compaction in readme

parent 21ef1680
......@@ -125,13 +125,15 @@ For details, see the [JSQL Reference](#jsql-reference) section.
When you load in a JSDB table, by default JSDB will compact the JSDF file.
Compaction is important for two reasons:
Compaction is important for two reasons; during compaction:
- It is when deleted data is actually deleted from disk. (Privacy.)
- It is when old version of updated data are actually removed. (Again, privacy.)
- Deleted data is actually deleted from disk. (Privacy.)
- Old versions of updated data are actually removed. (Again, privacy.)
Compaction will also reduce the size of your tables.
That said, compaction is a relatively slow process that gets increasingly slower as the size of your database grows (it has O(N) time complexity as the whole database is recreated).
You do have the option to override the default behaviour and keep all history. You might want to do this, for example, if you’re creating a web app that lets you create a drawing and you want to play the drawing back stroke by stroke, etc.
Now that you’ve loaded the file back, look at the `./db/people.js` JSDF file again to see how it looks after compaction:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment