Recently, I've been researching efficient ways to store and retrieve data for my time management/project capturing application. I would greatly appreciate any insights on which storage strategy to utilize, or suggestions for alternative approaches, especially considering the limited local storage resources across different browsers.
Here's the main data I need to manage:
db_projects: This database stores the projects themselves.
db_timestamps: This contains timestamps for each project when it is active.
I've come up with the following strategies:
1: Storing project status in timestamps
When a project starts, a timestamp is added to db_timestamps like this:
db_timestamps.put({
_id: String(Date.now()),
title: projectID,
status: status //could be: 1=active/2=inactive/3=paused
})...
This approach focuses on only adding data to the database without modifying entries. However, retrieving all active projects might require querying the entire db_timestamps which could be resource-intensive if it contains numerous entries.
2: Storing project status in db_projects
Whenever a project status changes, it is updated in the project itself. This makes querying for active projects more resource-friendly compared to timestamps. But, frequent status changes would lead to revisioning of project entries, potentially creating a lot of overhead. I'm unsure if the compaction feature would effectively handle this, as not all revision data is deleted entirely.
3: Storing status in a separate DB like db_status
This approach encounters similar challenges as #2, as status changes trigger revisions in this separate DB. If states are added in "only add data" mode, the DB could quickly become filled with entries.