objectbox / objectbox/objectbox-java
Option to shrink unused space
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.6k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Description
Did not find any info on that, so decided to ask here - is there (or planned) an option to shrink (e.g. compact the database)?
We're using objectbox for quite a long time for a production app one entity there is used to collect various loggable information for further sending it to a server. Successfully sent entities gets removed from the database, however, the physical db file still grows constantly. (which is understandable)
I understand we can always delete the file before creating the ObjectBox instance in order to reduce the unused space, however there are other entities there so we'll need save and recreate them somehow in the new (emptied) datastore. Thus, kind of an option to the builder like .shrinkOnOpen() would be nice to have, so app may check the database size during the initialization process and shrink it when necessary.
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the datastore builder and database lifecycle APIs involved when an ObjectBox instance opens, along with how unused space is currently reclaimed. The issue's requested outcome is an optional operation that safely reduces the physical database file while preserving other entities; confirm the expected behavior and constraints in the comment discussion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100