Indexeddb takes up a lot of space

I noticed that if I clear all storage in browser and reload page, then indexeddb starts to take much less space after sync with socket (as I understand it stops storing all history of changes). But I don’t really understand how I can call it programmatically to optimize storage space from time to time.

Do you mean in the y-indexeddb library?

There does seem to be some code that compacts the database when it exceeds 500 records, which could explain the variable size that you are seeing:

I’m not convinced that you should be doing any IndexedDB optimizations with Yjs. It is stored in a very compact binary format.

Yjs always stores the history of changes, otherwise conflicts could not be resolved.

yes i mean y-indexeddb. But this behavior with compacts the database after 500 entries does not greatly reduce browser storage usage.
What I was talking about is the behavior when y-indexeddb and y-websocket are used on the frontend. When you click “clear site data” and reload the page, the document is completely loaded from the socket, and after this manipulation, browser storate usage decreases much more significantly than compression after 500 records

Yeah, I’m not sure why that is then.