How to reduce size of channel.db file for LND

hi.

Mine is 1.4G so not so big. still why not compact it if it improves.

i don’t want to do it at each boot.
i saw you can add this to your lnd.conf file :

[bolt]
db.bolt.auto-compact=true db.bolt.auto-compact-min-age=0

is it the right way ?

I also saw something like just applying sqlite3 on the channel.db file ( after shutting down the node).
would that do it too ?

thanks for the help

I would not edit these config files, instead use the ‘Advanced Settings’ UI of the lightning app. Both these options are listed there under ‘Optimization’.

If you don’t want to compact on each restart, look for ‘Database Re-compaction Delay’ and set how many hours need have passed before the next compaction is permitted (on reboot).

I believe the current recommendation to prevent FC is:

payments-expiration-grace-period=9999h

yes?

Also one you didn’t mention:

[routing]
routing.strictgraphpruning=true

This keeps a more compact graph without dead ends.

Also, even though sync-freelist=true allows for a faster startup time, there were reports that this increases the db growth: Proposal: drop support for sync-freelist · Issue #6837 · lightningnetwork/lnd · GitHub