> ## Documentation Index
> Fetch the complete documentation index at: https://hexxladb.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MVCC

> MVCC statistics, retention, and pruning APIs

## StatsMVCC

Counters for versioned rows.

```go theme={null}
stats, err := db.StatsMVCC()
fmt.Printf("CommitSeq: %d\n", stats.CommitSeq)
fmt.Printf("LogicalCellCount: %d\n", stats.LogicalCellCount)
fmt.Printf("VersionedRowCount: %d\n", stats.VersionedRowCount)
```

## SuggestedPruneBeforeSeq

Policy from `MVCCRetention`.

```go theme={null}
beforeSeq, err := db.SuggestedPruneBeforeSeq()
// Returns the suggested sequence based on retention policy
```

## PruneCellVersions

Delete stale cell versions before `beforeSeq`.

```go theme={null}
pruned, err := db.PruneCellVersions(beforeSeq, 100_000)
// Returns count of rows removed
```

## PruneCellVersionsByProfile

Same with profile-driven `maxDelete`.

```go theme={null}
plan := hexxladb.MVCCPrunePlan{
    Profile: hexxladb.PruneProfileBalanced,
}
pruned, err := db.PruneCellVersionsByProfile(plan)
```

Profiles:

* `PruneProfileLowLatency` — Aggressive pruning, minimal history
* `PruneProfileBalanced` — Default balance
* `PruneProfileLongHistory` — Conservative pruning, more history

## PruneScheduler

Operator-driven periodic prune helper.

```go theme={null}
scheduler := hexxladb.NewPruneScheduler(db)
pruned, err := scheduler.Tick(ctx)
// One bounded pass — call from your own timer
```

No background goroutine runs inside the library. You control when pruning happens.

## MVCCStats

```go theme={null}
type MVCCStats struct {
    CommitSeq         uint64
    LogicalCellCount  uint64
    VersionedRowCount uint64
}
```

## MVCCPruneProfile

```go theme={null}
type MVCCPruneProfile int

const (
    PruneProfileLowLatency MVCCPruneProfile = iota
    PruneProfileBalanced
    PruneProfileLongHistory
)
```

## GroupWALStats

Group-WAL flusher metrics (when group commit is configured).

```go theme={null}
stats, err := db.GroupWALStats()
```

## See also

* [MVCC](/storage/mvcc) — MVCC concepts and time-travel
* [Retention](/operations/retention) — Retention policies and pruning
