<p>Like vincenzopalazzo commented - it never stops growing by design. Solution is to add</p>
<pre><code>db.bolt.auto-compact=true
</code></pre>
<p>to the lnd config. Then the db gets &quot;compacted&quot; (means cleaned-up here) at lnd's startup. But take care for enough disk space. Why it sometimes grows so fast could not be revealed.</p>
<p>The complete discussion is here: <a href="https://github.com/lightningnetwork/lnd/issues/5705" rel="nofollow noreferrer">https://github.com/lightningnetwork/lnd/issues/5705</a></p>

CC BY-SA 4.0
2021-11-18T15:59:10.417Z
2021-11-18T15:59:10.417Z
Rainer Feike
<p>lnd 0.15.0 introduced changes that slow down the speed at which your <code>channel.db</code> grows in size, i.e. each update is much smaller. With 0.15.1 you are able to run an optional migration (add a section <code>[db]</code> with <code>db.prune-revocation=true</code> to your <code>lnd.conf</code>), which replaces all old updates by this new format. Using this optional migration you can reduce the total size of your <code>channel.db</code> by a lot, if you have open channels that were active before you updated to lnd 0.15.0.</p>
<p>With lnd 0.15.0 you should make sure not to configure <code>sync-freelist=true</code>, i.e. use <code>sync-freelist=false</code> or remove this from your configuration. If set to true, several users noticed dramatically faster DB file size growth. See <a href="https://github.com/lightningnetwork/lnd/issues/6837" rel="nofollow noreferrer">https://github.com/lightningnetwork/lnd/issues/6837</a>.</p>
<p>Note that the actual size on disk only reduces if you run compaction, i.e. you need to apply the migration(s) and then restart lnd (again) to compact the DB file(s).</p>
<p>On my node (c-otto.de) I was able to reduce the size of my <code>channel.db</code> file from around 27 GByte to 1 GByte using the changes in 0.15.0 and 0.15.1.</p>
<p>Note that future releases of lnd will also reduce the size of your <code>sphinxreplay.db</code> (see <a href="https://github.com/lightningnetwork/lnd/issues/7107" rel="nofollow noreferrer">https://github.com/lightningnetwork/lnd/issues/7107</a>) and <code>wtclient.db</code> (see <a href="https://github.com/lightningnetwork/lnd/issues/7035" rel="nofollow noreferrer">https://github.com/lightningnetwork/lnd/issues/7035</a>) by quite a lot.</p>

CC BY-SA 4.0
2022-12-01T09:25:23.847Z
2022-12-01T09:25:23.847Z
C-Otto
<p>I am running my lnd node since about 60 days. Looking at the file channel.db, I found it grows currently about 500M per day:</p>
<pre><code>btc@xxx:~/.lnd$ ls -al ./data/graph/mainnet/channel.db
-rw------- 1 btc btc 15776518144 Oct 19 14:31 ./data/graph/mainnet/channel.db

-rw------- 1 btc btc 16874332160 Oct 21 12:59 channel.db
</code></pre>
<p>What is in that file that needs 16GB and when will it stop growing?
Running lnd 0.13.3 on i9-9900K CPU Ubuntu 20.04, bitcoin-core.</p>
<p>EDIT: New data from Oct 27 added:</p>
<p>It's now</p>
<pre><code>-rw------- 1 btc btc 23279489024 Oct 27 09:20 channel.db
</code></pre>
<p>Growth of about 5 GB in 6 days with 2 amts forwarded and 1 new channel opened. Think I stop operating this. Someone with good alternatives to lnd?</p>

CC BY-SA 4.0
2021-11-15T14:45:26.237Z
This will be an open question, by generic idea the DB should never stop growing
vincenzopalazzo
<lightning-network><lightning-network-daemon><channels><ln-gossip>
Why is lnd's channel.db so huge and when will it stop growing
Rainer Feike
# Why is lnd's channel.db so huge and when will it stop growing

(Asked by: username_0 on 2021-10-21)

I am running my lnd node since about 60 days. Looking at the file channel.db, I found it grows currently about 500M per day:

```
btc@xxx:~/.lnd$ ls -al ./data/graph/mainnet/channel.db
-rw------- 1 btc btc 15776518144 Oct 19 14:31 ./data/graph/mainnet/channel.db

-rw------- 1 btc btc 16874332160 Oct 21 12:59 channel.db

```

What is in that file that needs 16GB and when will it stop growing?
Running lnd 0.13.3 on i9-9900K CPU Ubuntu 20.04, bitcoin-core.

EDIT: New data from Oct 27 added:

It's now

```
-rw------- 1 btc btc 23279489024 Oct 27 09:20 channel.db

```

Growth of about 5 GB in 6 days with 2 amts forwarded and 1 new channel opened. Think I stop operating this. Someone with good alternatives to lnd?

**Tags:** lightning-network, lightning-network-daemon, channels, ln-gossip

> **Comments:**
> **username_1**: This will be an open question, by generic idea the DB should never stop growing  

---

## 2 answers

### Answer by username_0 on 2021-11-18. Score: 1

Like username_1 commented - it never stops growing by design. Solution is to add

```
db.bolt.auto-compact=true

```

to the lnd config. Then the db gets "compacted" (means cleaned-up here) at lnd's startup. But take care for enough disk space. Why it sometimes grows so fast could not be revealed.

The complete discussion is here: <https://github.com/lightningnetwork/lnd/issues/5705>


---

### Answer by username_2 on 2022-12-01. Score: 0

lnd 0.15.0 introduced changes that slow down the speed at which your `channel.db` grows in size, i.e. each update is much smaller. With 0.15.1 you are able to run an optional migration (add a section `[db]` with `db.prune-revocation=true` to your `lnd.conf`), which replaces all old updates by this new format. Using this optional migration you can reduce the total size of your `channel.db` by a lot, if you have open channels that were active before you updated to lnd 0.15.0.

With lnd 0.15.0 you should make sure not to configure `sync-freelist=true`, i.e. use `sync-freelist=false` or remove this from your configuration. If set to true, several users noticed dramatically faster DB file size growth. See <https://github.com/lightningnetwork/lnd/issues/6837>.

Note that the actual size on disk only reduces if you run compaction, i.e. you need to apply the migration(s) and then restart lnd (again) to compact the DB file(s).

On my node (username_2.de) I was able to reduce the size of my `channel.db` file from around 27 GByte to 1 GByte using the changes in 0.15.0 and 0.15.1.

Note that future releases of lnd will also reduce the size of your `sphinxreplay.db` (see <https://github.com/lightningnetwork/lnd/issues/7107>) and `wtclient.db` (see <https://github.com/lightningnetwork/lnd/issues/7035>) by quite a lot.


---

