Index database pruning

Is index database pruned automatically or I have to do it myself?

I had relatively large folder I was syncing (1m files/1TB) and it made index database substantially larger - as expected. Now I have stopped sharing it and only have tiny shares left. But index database remains as big as before.

Did you remove the folder?

You might need a restart for compaction to kick in.

My share folder is still present - I removed all data from it. Now there are mere 10 files there I share.

I don’t mind to delete index as reindexing is fast for me now. It would though be nice if index database is sometimes cleaned from old no more valid data.

And yes I restarted syncthing few times already

Removing files will not remove the index entries, as there are still entries recording that the files were deleted.

1 Like

I removed share completely and restarted syncthing. Interestingly initially index size went slightly up but then shrunk - not to the size I would expect though. Roughly from 1GB to 500MB.

I waited few minutes - no change. I stopped syncthing, deleted index and started again. When all shares were indexed it is now 20MB.

It is not show stopper but definitely low priority bug or area of improvement. It might affect only heavy users’ cases and potentially lead to performance degradation. Difficult to quantify it. But it would be nice if database is “compacted” sometimes.

There’s two parts to this - what data we decide to keep / remove in the database, and how / when the database compacts itself. The latter is something we don’t really tune or control right now, so it can take a while from when something substantial is removed to when the database actually shrinks on disk. As for what we remove in the first place … removed folders are cleared out. Removed devices are not, I think. Deleted files are indeed not, because we need the history, but the blocks for it are.

2 Likes

Thank you guys for clarification and quick answers. I understand it now and can handle if needed.

Overall great job with syncthing. It is really good piece of software.

1 Like

Again not the biggest bug but I can definitely see that removed folders are not cleared out - at least not entirely. In my case even after 10 days database has hundreds of megabytes - when all folders are removed but one containing just few files (and it is the new one so no major history). In longer run it will require manually deleting database.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.