Skip to content

Store file notes in the filesystem rather than the database #6546

@alexdachin

Description

@alexdachin

Describe feature

Currently Trilium stores the contents of a File note type embedded inside the SQLite database.

While this is extremely nice for simplicity and portability, it can become problematic once you start uploading many reference files (for example some large quality images, large PDFs, videos etc). While in theory SQLite supports huge databases, storing many files in a single database makes the database file harder to backup, increases database lock times and increases the database corruption risk slightly.

I propose storing the files in the filesystem and storing a reference to them and extra metadata in the database. The files can be stored in the trilium-data directory to begin with for simplicity, but it also opens the gate for storing them in other places in the future (like S3 compatible storage systems). This keeps the SQLite database small and performant, enables faster incremental backups (like rsync), reduces the risk of database corruption and still allows Trilium to manage things like note hierarchy with cloning.

Would love to hear your thoughts on weather this approach could be added as a feature or if you feel it might complicate the setup too much.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BEIssues related to server-side/back-endDifficulty: Hard

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions