TRIGGER GC

Triggers the garbage collector on the source aggregator and propagates to all the leaves.

Introduction

Garbage collection is a process where unneeded versioned nodes for multi-version concurrency are eliminated. These versioned nodes can also be parts of a skip list index or hash index for in-memory data (for rowstore tables or columnstore segments stored in memory). A buffer manager maintains unused memory blocks for future use until no query or operation is using the unused memory anymore.

The garbage collection process automatically runs in the background, so it's normally not necessary to execute TRIGGER GC [FLUSH]. However, if memory-related errors or node failures are being generated, executing TRIGGER GC [FLUSH] might be appropriate.

Syntax

TRIGGER GC [FLUSH]

Arguments

  • FLUSH: Releases all unused memory back to the operating system.

Remarks

  • The garbage collector runs automatically. You may still need to manually trigger the GC in the following scenarios:

    • If you need to free up the cached memory, use the FLUSH option. (SingleStore only caches memory when it is available and not under any duress. Hence, this practice may turn out to be counter-productive because the caches will refill themselves over time as queries run.)

    • If one of the partitions is using more memory (while bulk-loading/deleting data or recovering from a restart) and you are forced to wait until the garbage collection completes.

  • This command can be run on any aggregator.

  • Only users with SUPER privileges can run this command.

  • Refer to the Permission Matrix for the required permission.

Examples

TRIGGER GC FLUSH;

Last modified: March 23, 2023

Was this article helpful?