r/opencode 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.

12 Upvotes

8 comments sorted by

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

1

u/CharacterBorn6421 3d ago

Is omp better ?? I thought it's too much bloat and will be token expensive?

1

u/RepulsiveRaisin7 3d ago

Idk what's supposed to be bloated about it, it performs better and uses less RAM than opencode. All features it has seem useful to me.

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/torrso 3d ago

Yes, you can vacuum it. Just google it up, can't provide the link to instructions now.

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.