Garbage Collection#

How garbage is created#

Doltgres creates on disk garbage. Doltgres transactions that do not have a corresponding Doltgres commit create on disk garbage. This garbage is most noticeable after large data imports.

Specifically, writes to Doltgres can result in multiple chunks of the prolly tree being rewritten, which writes a large portion of the tree. When you perform write operations without committing or delete a branch containing novel chunks, garbage is created.

How garbage is created

Online#

You can run garbage collection on your running SQL server using select dolt_gc through any connected client.

NOTE: Performing GC on a cluster replica which is in standby mode is not yet supported, and running select dolt_gc() on the replica will fail.

Automated GC#

Automatic garbage collection is enabled by default: the server periodically runs garbage collection in the background without any configuration. If you want to disable it, set the following in your config.yaml:

behavior:
  auto_gc_behavior:
    enable: false