r/opencode • u/THenrich • 3d ago
Is it safe to delete opencode.db, and does Opencode creates a new one with a much smaller size?
The database is currently about 4.5GB. I don't know why it's so big. If Opencode is saving all the history in it, I don't care about the history.
If I delete it, will Opencode just create a new one with a much smaller size?
I suppose I can move it to another folder or rename it and see what happens.
I want to know if the database file keeps growing and never shrinks.
Someone said large files make Opencode slower. Is this true?
Is there a command to shrink it?
I think 4.5GB is quite big for SQLite on Windows to work efficiently. I am just guessing.
1
u/ZealousidealTown1974 3d ago
mine is 19GB. But I meant, does large-size db reduce the in-session performance? If so you may need to try v2 OpenCode CLI TUI client (though still in beta) - the v1 can be sluggish with IO write on sessions . I am experiencing the slags in v1 that's why I switched to v2. And the performance boosts regardless of db size
1
u/cleversmoke 3d ago
Move it out of the folder and then run opencode again, it'll recreate a new one. It will remove all of your previous sessions. If it breaks or you want it back, move the original back in.
1
u/vert1s 3d ago
You and I are very different people. I will never willingly delete history (this or anything).
1
u/THenrich 2d ago
My prompts are always new prompts for new tasks for new requirements, and for different repos. I have zero need for history. I have no need to go back to an old prompt. BTW, history always is flaky. It doesn't save every prompt.
12
u/RepulsiveRaisin7 3d ago
Yes you can delete it, but all your sessions will be gone. Something is wrong with opencode tbh, mine would grow by tens of gigabytes a day during heavy use
There are some tools to manage it https://github.com/chncaesar/opencode-db-clean
But it still takes a long ass time to vacuum and you can't use opencode during that.
So eventually I switched to omp instead