mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
docs: explain merge insert execution costs (#4501)
resolves #4258 ## Summary - document how indexed partial-column merges patch columns across touched fragments - explain how full-scan merges rewrite rows and can materialize the target table - describe the index-coverage, batching, and memory tradeoffs - align the Python, Rust, and TypeScript `use_index` API documentation ## Verification - `git diff --check` - Ruff 0.15.20 formatting check for `python/python/lancedb/merge.py` - Biome 1.9.4 check for `nodejs/lancedb/merge.ts` - reviewed the rendered MDX structure and cross-SDK wording The TypeDoc generation command was also attempted. It cannot complete in this checkout because the Rust-generated `nodejs/lancedb/native.d.ts` artifact is absent and Rust tooling is not installed; TypeDoc stops on the resulting pre-existing module-resolution errors before generating output. --------- Signed-off-by: Himanshu S <me.mrhimanshu@gmail.com> Co-authored-by: Himanshu <18554133+mrhimanshu@users.noreply.github.com> Co-authored-by: Himanshu S <me.mrhimanshu@gmail.com>
This commit is contained in:
co-authored by
Himanshu
Himanshu S
parent
0ba8b6f0a8
commit
80c889cd9e
@@ -187,14 +187,30 @@ impl MergeInsertBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
/// Controls whether to use indexes for the merge operation.
|
||||
/// Controls the join and write strategy for the merge operation.
|
||||
///
|
||||
/// When set to `true` (the default), the operation will use an index if available
|
||||
/// on the join key for improved performance. When set to `false`, it forces a full
|
||||
/// table scan even if an index exists. This can be useful for benchmarking or when
|
||||
/// the query optimizer chooses a suboptimal path.
|
||||
/// When `true` (the default), the operation can use scalar indexes on the join
|
||||
/// keys when the operation supports the indexed path and all join keys have
|
||||
/// usable indexes. When a partial-column update actually takes this path, it
|
||||
/// patches the supplied non-key columns, rewriting those columns for every row
|
||||
/// in each fragment containing a match.
|
||||
///
|
||||
/// If not set, defaults to `true` (use index if available).
|
||||
/// An indexed partial update preserves index coverage on the join keys, but
|
||||
/// indexes on the rewritten non-key columns, including vector indexes, lose
|
||||
/// coverage in the patched fragments. Newly written rows, including inserted
|
||||
/// rows and full-row replacements, are not covered by existing indexes until the
|
||||
/// indexes are optimized.
|
||||
///
|
||||
/// When `false`, the operation performs a full-scan join and rewrites matched rows
|
||||
/// by deleting and appending them. This can also happen with `true`, for example
|
||||
/// when a join key lacks a usable index or a partial-column update includes a
|
||||
/// blob column. Any full-scan plan can materialize the entire target table on the
|
||||
/// hash-join build side and exhaust the server on large tables. The default flag
|
||||
/// alone is not a memory safeguard. Do not treat `false` as a general-purpose
|
||||
/// row-rewrite switch.
|
||||
///
|
||||
/// See [How merge insert executes](https://docs.lancedb.com/ingestion/merge-insert#how-merge-insert-executes)
|
||||
/// for the performance and index-coverage tradeoffs.
|
||||
pub fn use_index(&mut self, use_index: bool) -> &mut Self {
|
||||
self.use_index = use_index;
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user