-
Notifications
You must be signed in to change notification settings - Fork 1
15 Configuration.md
QuiverDbOptions provides the following configurations:
var options = new QuiverDbOptions
{
// Database file path. null for in-memory mode (no persistence)
// Directory is auto-created by storage provider if it doesn't exist
DatabasePath = @"C:\Data\MyQuiverDb.vdb",
// Default distance metric (entity-level [QuiverVector] attribute can override)
DefaultMetric = DistanceMetric.Cosine,
// ── Vector payload memory ──
Vectors =
{
MemoryMode = GlobalVectorMemoryMode.Auto,
MemoryMapThresholdBytes = 256L * 1024 * 1024,
},
// ── Large field payload memory ──
LargeFields =
{
MemoryMode = GlobalLargeFieldMemoryMode.PagedCache,
MaxCachedPayloads = 128,
},
// ── Background auto-merge (used with AppendAsync / FlushTombstonesAsync) ──
EnableBackgroundMerge = true,
AutoMergeMaxSegments = 32,
AutoMergeTombstoneRatio = 0.25
};| Property | Type | Default | Description |
|---|---|---|---|
DatabasePath |
string? |
null |
Storage path; null for in-memory mode (SaveAsync then requires an explicit path) |
DefaultMetric |
DistanceMetric |
Cosine |
Default distance metric |
Vectors.MemoryMode |
GlobalVectorMemoryMode |
InMemory |
InMemory / LazyLoad / MemoryMapped / Auto / PerField vector payload memory behavior |
Vectors.MemoryMapThresholdBytes |
long |
256 MiB |
Open-time threshold for GlobalVectorMemoryMode.Auto: existing database files at or above this size open vectors as MemoryMapped
|
Vectors.MaxInMemoryBytes |
long |
1 GiB |
Runtime heap-vector budget used with Vectors.AutoPromoteToMemoryMapped
|
Vectors.AutoPromoteToMemoryMapped |
bool |
false |
Enables runtime promotion from InMemory to MemoryMapped when Vectors.MaxInMemoryBytes is exceeded |
LargeFields.MemoryMode |
GlobalLargeFieldMemoryMode |
InMemory |
InMemory / LazyLoad / PagedCache / PerField large-field payload behavior |
LargeFields.MaxCachedPayloads |
int |
128 |
Max cached large-field payloads when using PagedCache
|
EnableBackgroundMerge |
bool |
false |
Run MaybeAutoMergeAsync after AppendAsync / FlushTombstonesAsync
|
AutoMergeMaxSegments |
int |
32 |
Trigger merge when live segment count exceeds this number |
AutoMergeTombstoneRatio |
double |
0.25 |
Trigger merge when tombstone-to-live ratio exceeds this value |
SaveOnDispose |
bool |
false |
When true, DisposeAsync() calls SaveAsync() before releasing resources |
When Vectors.MemoryMode = GlobalVectorMemoryMode.PerField, each [QuiverVector] field uses its own MemoryMode. If the field does not explicitly set it, this is not an error; the attribute default is VectorMemoryMode.InMemory, so that field stays in memory.
When LargeFields.MemoryMode = GlobalLargeFieldMemoryMode.PerField, each [QuiverLargeField] field uses its own MemoryMode. If the field does not explicitly set it, this is not an error; the attribute default is LargeFieldMemoryMode.InMemory, so that field is loaded in memory.
Auto and PerField exist only on the global enums (GlobalVectorMemoryMode / GlobalLargeFieldMemoryMode). Field-level enums only support concrete strategies.
Vectors.MemoryMapThresholdBytes is checked when the database is opened and only affects GlobalVectorMemoryMode.Auto; it uses the existing database file size. Vectors.MaxInMemoryBytes is checked while the process is running; it uses the current managed-heap vector bytes and only triggers promotion when Vectors.AutoPromoteToMemoryMapped is enabled.
⚠️ Native AOT Compatibility:QuiverDbOptionsitself is AOT-safe (plain POCO). However, theQuiverDbContextthat consumes it is not Native AOT-compatible — it uses runtime reflection forQuiverSet<T>discovery and compiles expression-tree property accessors at startup. Do not publish Quiver applications withPublishAot=true.
| # | 章节 |
|---|---|
| 01 | 版本说明 |
| 02 | 产品概述 |
| 03 | 架构概述 |
| 04 | 快速开始 |
| 05 | 核心概念 |
| 06 | 距离度量 |
| 07 | 索引类型 |
| 08 | CRUD 操作 |
| 09 | 向量搜索 |
| 10 | 持久化存储 |
| 11 | 迁移系统 |
| 11a | 模式迁移 |
| 12 | 多向量字段支持 |
| 13 | 线程安全与并发 |
| 14 | 生命周期管理 |
| 15 | 配置选项 |
| 16 | 内部实现细节 |
| 17 | 完整示例 |
| 18 | API 参考速查表 |
| 19 | 使用建议 |