diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index a628c6fa0..9d28ac5e4 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -240,18 +240,11 @@ jobs:
sudo mkswap "$swapfile"
sudo swapon "$swapfile"
- name: Build
- run: cargo build --profile ci --all-features --tests --locked --examples
- - name: Reclaim completed workspace build artifacts
- run: |
- # Package-level tests resolve a different feature graph from the workspace
- # build. Reclaim its lancedb outputs before linking the test graph.
- df -h .
- cargo clean --profile ci -p lancedb
- df -h .
+ run: cargo build --profile ci -p lancedb --all-features --tests --locked --examples
- name: Run feature tests
run: CARGO_ARGS="--profile ci" make -C ./lancedb feature-tests
- name: Run examples
- run: cargo run --profile ci --all-features --example simple --locked
+ run: cargo run --profile ci -p lancedb --all-features --example simple --locked
- name: Run blob v2 docs example
# Python and TypeScript blob docs tests install preview packages.
# Those builds are not guaranteed to remain available for more than
diff --git a/Cargo.lock b/Cargo.lock
index d982756e4..036ab15e5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3814,8 +3814,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]]
name = "fsst"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"rand 0.9.5",
@@ -5292,8 +5292,8 @@ checksum = "e037a2e1d8d5fdbd49b16a4ea09d5d6401c1f29eca5ff29d03d3824dba16256a"
[[package]]
name = "lance"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arc-swap",
"arrow",
@@ -5368,8 +5368,8 @@ dependencies = [
[[package]]
name = "lance-arrow"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5391,7 +5391,7 @@ dependencies = [
[[package]]
name = "lance-arrow-scalar"
version = "59.0.0"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5405,7 +5405,7 @@ dependencies = [
[[package]]
name = "lance-arrow-stats"
version = "59.0.0"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5414,8 +5414,8 @@ dependencies = [
[[package]]
name = "lance-bitpacking"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrayref",
"crunchy",
@@ -5425,8 +5425,8 @@ dependencies = [
[[package]]
name = "lance-core"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5464,8 +5464,8 @@ dependencies = [
[[package]]
name = "lance-datafusion"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow",
"arrow-array",
@@ -5496,8 +5496,8 @@ dependencies = [
[[package]]
name = "lance-datafusion-exec"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow",
"arrow-array",
@@ -5522,8 +5522,8 @@ dependencies = [
[[package]]
name = "lance-datagen"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow",
"arrow-array",
@@ -5540,8 +5540,8 @@ dependencies = [
[[package]]
name = "lance-derive"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"proc-macro2",
"quote",
@@ -5550,8 +5550,8 @@ dependencies = [
[[package]]
name = "lance-encoding"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -5584,8 +5584,8 @@ dependencies = [
[[package]]
name = "lance-file"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-arith",
"arrow-array",
@@ -5616,8 +5616,8 @@ dependencies = [
[[package]]
name = "lance-geo"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5648,8 +5648,8 @@ dependencies = [
[[package]]
name = "lance-index"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arc-swap",
"arrow",
@@ -5720,8 +5720,8 @@ dependencies = [
[[package]]
name = "lance-index-core"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5744,8 +5744,8 @@ dependencies = [
[[package]]
name = "lance-io"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow",
"arrow-array",
@@ -5790,8 +5790,8 @@ dependencies = [
[[package]]
name = "lance-jsonb"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"byteorder",
"ethnum",
@@ -5808,7 +5808,7 @@ dependencies = [
[[package]]
name = "lance-linalg"
-version = "15.0.0-beta.14"
+version = "15.0.0-beta.15"
dependencies = [
"approx",
"argminmax 0.7.1",
@@ -5830,8 +5830,8 @@ dependencies = [
[[package]]
name = "lance-namespace"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow",
"async-trait",
@@ -5845,8 +5845,8 @@ dependencies = [
[[package]]
name = "lance-namespace-impls"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arc-swap",
"arrow",
@@ -5900,8 +5900,8 @@ dependencies = [
[[package]]
name = "lance-select"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-buffer",
@@ -5915,8 +5915,8 @@ dependencies = [
[[package]]
name = "lance-table"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow",
"arrow-array",
@@ -5957,8 +5957,8 @@ dependencies = [
[[package]]
name = "lance-testing"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"arrow-array",
"arrow-schema",
@@ -5971,8 +5971,8 @@ dependencies = [
[[package]]
name = "lance-tokenizer"
-version = "15.0.0-beta.14"
-source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.14#3bb1550f4f27adf90948ff36c2318768e675b599"
+version = "15.0.0-beta.15"
+source = "git+https://github.com/lance-format/lance.git?tag=v15.0.0-beta.15#a826a940d550ee1f3bb5b470c3e10e670c1e38ce"
dependencies = [
"frostem",
"icu_segmenter",
diff --git a/Cargo.toml b/Cargo.toml
index f89d1f555..0e0ef737c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,20 +20,20 @@ categories = ["database-implementations"]
rust-version = "1.95.0"
[workspace.dependencies]
-lance = { "version" = "=15.0.0-beta.14", default-features = false, "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-core = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-datagen = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-file = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-io = { "version" = "=15.0.0-beta.14", default-features = false, "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-index = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-jsonb = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-namespace = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-namespace-impls = { "version" = "=15.0.0-beta.14", default-features = false, "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-table = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-testing = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-datafusion = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-encoding = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
-lance-arrow = { "version" = "=15.0.0-beta.14", "tag" = "v15.0.0-beta.14", "git" = "https://github.com/lance-format/lance.git" }
+lance = { "version" = "=15.0.0-beta.15", default-features = false, "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-core = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-datagen = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-file = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-io = { "version" = "=15.0.0-beta.15", default-features = false, "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-index = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-jsonb = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-namespace = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-namespace-impls = { "version" = "=15.0.0-beta.15", default-features = false, "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-table = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-testing = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-datafusion = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-encoding = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
+lance-arrow = { "version" = "=15.0.0-beta.15", "tag" = "v15.0.0-beta.15", "git" = "https://github.com/lance-format/lance.git" }
lancedb = { path = "rust/lancedb", default-features = false }
ahash = "0.8"
anyhow = "1"
diff --git a/docs/src/js/classes/Table.md b/docs/src/js/classes/Table.md
index 8bdc6b5f8..1fad723fe 100644
--- a/docs/src/js/classes/Table.md
+++ b/docs/src/js/classes/Table.md
@@ -948,6 +948,9 @@ supported. Pruning old versions and index optimization are silently
skipped there instead of being attempted, so this call resolves
successfully, with zeroed pruning statistics, once the compaction job
has been submitted; it does not wait for that job to finish.
+`compactionOptions` can tune the four per-job settings documented in
+[CompactionOptions](../interfaces/CompactionOptions.md). Older-server errors are propagated without
+retrying with the settings removed.
#### Parameters
diff --git a/docs/src/js/globals.md b/docs/src/js/globals.md
index 46f8db833..dab1c61bc 100644
--- a/docs/src/js/globals.md
+++ b/docs/src/js/globals.md
@@ -74,6 +74,7 @@
- [ClientConfig](interfaces/ClientConfig.md)
- [ColumnAlteration](interfaces/ColumnAlteration.md)
- [ColumnOrdering](interfaces/ColumnOrdering.md)
+- [CompactionOptions](interfaces/CompactionOptions.md)
- [CompactionStats](interfaces/CompactionStats.md)
- [ConnectNamespaceOptions](interfaces/ConnectNamespaceOptions.md)
- [ConnectionOptions](interfaces/ConnectionOptions.md)
diff --git a/docs/src/js/interfaces/CompactionOptions.md b/docs/src/js/interfaces/CompactionOptions.md
new file mode 100644
index 000000000..135266567
--- /dev/null
+++ b/docs/src/js/interfaces/CompactionOptions.md
@@ -0,0 +1,49 @@
+[**@lancedb/lancedb**](../README.md) • **Docs**
+
+***
+
+[@lancedb/lancedb](../globals.md) / CompactionOptions
+
+# Interface: CompactionOptions
+
+Per-invocation compaction settings. Values must be safe integers.
+
+## Properties
+
+### batchSize?
+
+```ts
+optional batchSize: number;
+```
+
+Positive scanner batch size in rows.
+
+***
+
+### ioBufferSize?
+
+```ts
+optional ioBufferSize: number;
+```
+
+Scanner I/O read-ahead budget in bytes; zero disables byte-based I/O backpressure.
+
+***
+
+### maxSourceRows?
+
+```ts
+optional maxSourceRows: number;
+```
+
+Positive live-source-row budget across whole tasks; an oversized first task can produce no work.
+
+***
+
+### targetRowsPerFragment?
+
+```ts
+optional targetRowsPerFragment: number;
+```
+
+Positive target rows per output fragment; also affects candidate selection.
diff --git a/docs/src/js/interfaces/OptimizeOptions.md b/docs/src/js/interfaces/OptimizeOptions.md
index 110eb3813..faf1d2724 100644
--- a/docs/src/js/interfaces/OptimizeOptions.md
+++ b/docs/src/js/interfaces/OptimizeOptions.md
@@ -33,6 +33,28 @@ tbl.optimize({cleanupOlderThan: new Date()});
***
+### compactionOptions?
+
+```ts
+optional compactionOptions: CompactionOptions;
+```
+
+Compaction settings for this invocation. Omitted remote values inherit table
+tuning, then deployment/built-in defaults.
+Remote tables require a server supporting these SQL options; settings do
+not change table policy. This is not a runtime or total-memory limit.
+
+#### Example
+
+```ts
+await tbl.optimize({ compactionOptions: {
+ targetRowsPerFragment: 1000, maxSourceRows: 5000,
+ ioBufferSize: 64 * 1024 * 1024, batchSize: 128,
+} });
+```
+
+***
+
### deleteUnverified
```ts
diff --git a/docs/src/python/python.md b/docs/src/python/python.md
index 3658f2ad3..7e5140928 100644
--- a/docs/src/python/python.md
+++ b/docs/src/python/python.md
@@ -352,9 +352,27 @@ accept the LanceDB Embedded options: cleanup and compaction warn that they are n
`optimize` submits a durable compaction job and returns once that submission is
accepted, not once compaction itself finishes. Pruning and index optimization
are not yet supported remotely, so it silently skips them and returns with
-zeroed pruning statistics rather than attempting and failing. A non-default
-`compaction_options` raises `NotImplementedError` before anything is
-submitted, since there is no way yet to forward those settings to the server.
+zeroed pruning statistics. Remote `compaction_options` support per-job
+`target_rows_per_fragment`, `max_source_rows`, `io_buffer_size`, and `batch_size`
+on compatible servers. Other non-default settings raise `NotImplementedError`
+before submission; older-server errors are returned without dropping options.
+The source-row budget selects whole tasks and can produce no work if the first
+task exceeds it. An I/O buffer size of zero disables byte-based I/O backpressure.
+Use a positive size to limit I/O read-ahead; this is not a total-memory limit.
+Each field resolves as invocation option → table tuning → deployment/built-in
+default. These options apply only to the submitted job and leave table policy
+unchanged. Table `enabled` controls automatic scheduling; explicit manual runs
+remain allowed.
+
+```python
+table.optimize(compaction_options={
+ "target_rows_per_fragment": 100_000,
+ "max_source_rows": 1_000_000,
+ "io_buffer_size": 64 * 1024 * 1024,
+ "batch_size": 1024,
+})
+```
+
Removed Tantivy options produce the same explanatory errors on both backends.
The old LanceDB Enterprise keyword names `predicate` for `delete`, `index_name` for
diff --git a/docs/web/feature-engineering/refresh-column.mdx b/docs/web/feature-engineering/refresh-column.mdx
index 8f5726307..ac4ff93fe 100644
--- a/docs/web/feature-engineering/refresh-column.mdx
+++ b/docs/web/feature-engineering/refresh-column.mdx
@@ -22,7 +22,7 @@ Computed columns require LanceDB Enterprise.
job = table.refresh_column_async("doubled")
job.wait()
-table.to_arrow().sort_by("x").to_pandas()
+table.search().to_arrow().sort_by("x").to_pandas()
# x doubled
# 0 1 2
# 1 2 4
@@ -77,13 +77,21 @@ catch-up works when it's re-enabled after being off.
## Refreshing part of a table {#partial}
-Enterprise In SQL a refresh can be scoped to a
-predicate, which is useful for filling a slice first and checking it before
-committing to the whole table:
+Enterprise A refresh can be scoped to a predicate,
+with `where=` in Python or `WHERE` in SQL, which is useful for filling a slice
+first and checking it before committing to the whole table:
+```python Python icon="python"
+job = table.refresh_column_async(
+ "embedding",
+ where="created_at > date '2026-01-01'",
+)
+job.wait()
+```
+
```sql SQL icon="database"
-REFRESH COLUMN embedding ON documents WHERE created_at > '2026-01-01'
+REFRESH COLUMN embedding ON documents WHERE created_at > date '2026-01-01'
```
@@ -92,9 +100,17 @@ whose outputs are already current. Repeating the same predicate repeats those
Function calls and their cost. To select only null outputs within a slice:
+```python Python icon="python"
+job = table.refresh_column_async(
+ "embedding",
+ where="created_at > date '2026-01-01' AND embedding IS NULL",
+)
+job.wait()
+```
+
```sql SQL icon="database"
REFRESH COLUMN embedding ON documents
- WHERE created_at > '2026-01-01' AND embedding IS NULL
+ WHERE created_at > date '2026-01-01' AND embedding IS NULL
```
@@ -247,13 +263,14 @@ and `gpuCount` in the `refreshColumnAsync` options.
The job APIs also take the row filter and failure handling of the SQL
`REFRESH COLUMN ... WHERE ... WITH (...)` form, so a refresh can be narrowed
-to new rows and told to skip rows whose Function call fails:
+to new rows (see [what a filter recomputes](#partial)) and told to skip rows
+whose Function call fails:
```python
job = table.refresh_column_async(
"embedding",
- where="published_at > '2026-01-01'",
+ where="created_at > date '2026-01-01'",
error_policy="skip",
max_failed_fraction=0.01,
row_timeout_seconds=30,
@@ -262,7 +279,7 @@ job = table.refresh_column_async(
```typescript
const job = await table.refreshColumnAsync("embedding", {
- where: "published_at > '2026-01-01'",
+ where: "created_at > date '2026-01-01'",
errorPolicy: "skip",
maxFailedFraction: 0.01,
rowTimeoutSeconds: 30,
@@ -276,7 +293,7 @@ let _job = table
.refresh_column_async_with_options(
"embedding",
RefreshColumnOptions::default()
- .where_clause("published_at > '2026-01-01'")
+ .where_clause("created_at > date '2026-01-01'")
.error_policy(FunctionErrorPolicy::Skip)
.max_failed_fraction(0.01)
.row_timeout_seconds(30.0),
diff --git a/docs/web/feature-engineering/refresh-materialized-view.mdx b/docs/web/feature-engineering/refresh-materialized-view.mdx
index eca66d230..74fcce2fb 100644
--- a/docs/web/feature-engineering/refresh-materialized-view.mdx
+++ b/docs/web/feature-engineering/refresh-materialized-view.mdx
@@ -59,6 +59,65 @@ Use `view.table.count_rows()` for the view's row count at any time; on
LanceDB Embedded it always matches `rows_written` from the most recent
refresh.
+{/*
+Draft: publish this section after the Python/Rust resource-budget SDK support
+is released. TypeScript parity is tracked separately in issue #4903.
+
+## Resource budgets {#resources}
+
+For training-data curation, bound the resources used to recompute a view:
+
+
+```python Python icon="python"
+job = view.refresh_async(
+ cpu_millis=8000,
+ memory_bytes=16 * 1024**3,
+ gpu_count=2,
+ gpu_class="h100",
+)
+job.wait()
+```
+
+```rust Rust icon="rust"
+use lancedb::materialized_view::MaterializedView;
+
+async fn refresh(view: &MaterializedView) -> lancedb::Result<()> {
+ let job = view
+ .refresh()
+ .cpu_millis(8000)
+ .memory_bytes(16_u64 << 30)
+ .gpu_count(2)
+ .gpu_class("h100")
+ .execute_async()
+ .await?;
+ job.wait().await?;
+ Ok(())
+}
+```
+
+
+The same options are available on `refresh`, asynchronous Python connections,
+and the Rust refresh builder (`cpu_millis`, `memory_bytes`, `gpu_count`, and
+`gpu_class`). CPU is in millicores (8000 means eight cores), memory is bytes,
+and GPU count is an aggregate concurrent cap. CPU or memory requires all three
+budget fields. Use zero GPUs for a CPU-only view, or specify a GPU cap alone.
+
+The cap covers the refresh execution and its Function processes together.
+It does not allocate that budget separately to each Function. A GPU class
+selects placement for this execution; discover configured classes with
+`db.list_gpu_classes()`. A cap does not promise more parallelism: current MV
+refreshes use at most one GPU. Omitted settings keep existing defaults.
+
+These controls require an Enterprise server with an isolated backend that can
+enforce them; Embedded and unsupported execution backends reject them. Earlier
+Enterprise servers reject the new SQL options. See the
+[SQL resource options](/sql/dml/refresh-materialized-view#resources).
+
+TypeScript does not expose these options yet; SDK parity is tracked in
+[issue #4903](https://github.com/lancedb/lancedb/issues/4903).
+
+*/}
+
## Automatic refresh {#auto-refresh}
A materialized view can refresh itself on a schedule instead of waiting
diff --git a/docs/web/maintenance/compaction.mdx b/docs/web/maintenance/compaction.mdx
index 3110c0858..9c8765293 100644
--- a/docs/web/maintenance/compaction.mdx
+++ b/docs/web/maintenance/compaction.mdx
@@ -150,9 +150,10 @@ task at a time can also reduce memory use.
The Rust example runs compaction only. Run pruning and index optimization
separately when needed; Python's `optimize()` includes those steps.
-TypeScript's `optimize()` does not currently expose the fragment row target,
-scan batch size, or compaction thread count. These tuning examples apply to
-Python and Rust tables in LanceDB Embedded.
+TypeScript's `optimize()` exposes the fragment row target through
+`compactionOptions.targetRowsPerFragment` and the scanner batch size through
+`compactionOptions.batchSize`. Compaction thread count is not exposed. The tuning
+examples above use Python and Rust tables in LanceDB Embedded.
Planning remains row based. The row target bounds later passes after existing
oversized fragments have been rewritten; the first pass rewrites those
diff --git a/docs/web/sql/dml/refresh-column.mdx b/docs/web/sql/dml/refresh-column.mdx
index 98a360366..fcb78bd35 100644
--- a/docs/web/sql/dml/refresh-column.mdx
+++ b/docs/web/sql/dml/refresh-column.mdx
@@ -24,7 +24,7 @@ REFRESH COLUMN ON [TABLE]
```sql SQL icon="database"
REFRESH COLUMN doubled ON my_table
-REFRESH COLUMN embedding ON documents WHERE created_at > '2026-01-01'
+REFRESH COLUMN embedding ON documents WHERE created_at > date '2026-01-01'
```
@@ -39,7 +39,7 @@ calls and their cost. To select only null outputs within a slice:
```sql SQL icon="database"
REFRESH COLUMN embedding ON documents
- WHERE created_at > '2026-01-01' AND embedding IS NULL
+ WHERE created_at > date '2026-01-01' AND embedding IS NULL
```
diff --git a/docs/web/sql/dml/refresh-materialized-view.mdx b/docs/web/sql/dml/refresh-materialized-view.mdx
index ecb4e84d1..e83337c7d 100644
--- a/docs/web/sql/dml/refresh-materialized-view.mdx
+++ b/docs/web/sql/dml/refresh-materialized-view.mdx
@@ -14,7 +14,8 @@ A LanceDB extension with no DataFusion equivalent.
```sql SQL icon="database"
REFRESH MATERIALIZED VIEW
- [WITH (full = )]
+ [WITH (full = , cpu_millis = , memory_bytes = ,
+ gpu_count = , gpu_class = '')]
```
@@ -36,6 +37,39 @@ regardless of what a local SDK's `refresh()` method accepts -- do not
assume the two option sets match.
+## Resource budgets {#resources}
+
+Set budgets for one refresh execution:
+
+```sql
+REFRESH MATERIALIZED VIEW curated_training_set WITH (
+ cpu_millis = 8000,
+ memory_bytes = 17179869184,
+ gpu_count = 2,
+ gpu_class = 'h100'
+);
+```
+
+`cpu_millis` is CPU capacity in millicores (1000 = one core), not CPU time.
+`memory_bytes` caps memory in bytes. `gpu_count` caps concurrent GPUs for the
+refresh. These are aggregate caps across its SQL execution and Function
+processes; they are not multiplied by the number of Functions in the query.
+
+CPU or memory requires all three budget fields. CPU and memory must be positive;
+`gpu_count = 0` is allowed for CPU-only views. A GPU budget alone is also accepted.
+A cap does not reserve all of its GPUs or increase refresh parallelism. Current
+MV refreshes use at most one GPU, shared by their GPU Function calls.
+
+`gpu_class` selects an operator-configured class for this execution, leaving the
+Function registration and saved MV placement unchanged. Use `SHOW GPU CLASSES`
+to discover configured classes. Omitted budgets and class preserve defaults.
+Options can be combined with `full = true`.
+
+This requires an Enterprise server and an isolated execution backend that can
+enforce resource budgets. Unsupported backends reject constrained refreshes.
+Older servers reject the new options. Saved defaults and automatic refresh
+configuration are unchanged.
+
## Watching a refresh {#watching}
A refresh submits work that outlives the call. Track it with
diff --git a/java/pom.xml b/java/pom.xml
index 161e13c2c..88b66b3ad 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -28,7 +28,7 @@
UTF-8
15.0.0
- 15.0.0-beta.8
+ 15.0.0-beta.15
2.18.12
false
2.30.0
diff --git a/nodejs/__test__/table.test.ts b/nodejs/__test__/table.test.ts
index af66ebb60..c3888d6c0 100644
--- a/nodejs/__test__/table.test.ts
+++ b/nodejs/__test__/table.test.ts
@@ -11,6 +11,7 @@ import {
AutoQuery,
type BlobInput,
type BlobMode,
+ type CompactionOptions,
Connection,
MatchQuery,
PhraseQuery,
@@ -3997,7 +3998,93 @@ it("passes cleanupOlderThan to the native binding as an absolute timestamp", asy
await table.optimize({ cleanupOlderThan: cutoff, deleteUnverified: true });
- expect(optimize).toHaveBeenCalledWith(cutoff.getTime(), true);
+ expect(optimize).toHaveBeenCalledWith(cutoff.getTime(), true, undefined);
+});
+
+it("forwards per-job compaction options to the native binding", async () => {
+ const optimize = jest.fn().mockResolvedValue({});
+ const table = new LocalTable({ optimize } as never);
+ const compactionOptions = {
+ targetRowsPerFragment: 20,
+ maxSourceRows: 25,
+ ioBufferSize: 0,
+ batchSize: 8,
+ };
+ await table.optimize({ compactionOptions });
+ expect(optimize).toHaveBeenCalledWith(
+ undefined,
+ undefined,
+ compactionOptions,
+ );
+});
+
+it("rejects unsupported JavaScript compaction options before native submission", async () => {
+ const optimize = jest.fn();
+ const table = new LocalTable({ optimize } as never);
+ await expect(
+ table.optimize({
+ compactionOptions: {
+ maxSourceBytes: 1024,
+ } as unknown as CompactionOptions,
+ }),
+ ).rejects.toThrow("Unsupported compaction option: maxSourceBytes");
+ expect(optimize).not.toHaveBeenCalled();
+});
+
+describe("per-job compaction options", () => {
+ let tmpDir: tmp.DirResult;
+ let table: Table;
+ beforeEach(async () => {
+ tmpDir = tmp.dirSync({ unsafeCleanup: true });
+ const db = await connect(tmpDir.name);
+ table = await db.createTable(
+ "bounded",
+ Array.from({ length: 10 }, (_, id) => ({ id })),
+ );
+ for (let f = 1; f < 8; f++) {
+ await table.add(
+ Array.from({ length: 10 }, (_, id) => ({ id: f * 10 + id })),
+ );
+ }
+ });
+ afterEach(() => {
+ tmpDir.removeCallback();
+ });
+ it("bounds source work and preserves zero I/O buffering", async () => {
+ const stats = await table.optimize({
+ compactionOptions: {
+ targetRowsPerFragment: 20,
+ maxSourceRows: 25,
+ ioBufferSize: 0,
+ batchSize: 8,
+ },
+ });
+ expect(stats.compaction.fragmentsRemoved).toBe(2);
+ expect(stats.compaction.fragmentsAdded).toBe(1);
+ expect(await table.countRows()).toBe(80);
+ const defaults = await table.optimize();
+ expect(defaults.compaction.fragmentsRemoved).toBe(7);
+ expect(defaults.compaction.fragmentsAdded).toBe(1);
+ expect(await table.countRows()).toBe(80);
+ });
+ const invalid: CompactionOptions[] = [
+ { targetRowsPerFragment: 0 },
+ { maxSourceRows: 0 },
+ { batchSize: 0 },
+ { ioBufferSize: -1 },
+ { batchSize: 1.5 },
+ { maxSourceRows: Number.NaN },
+ { ioBufferSize: Number.POSITIVE_INFINITY },
+ { maxSourceRows: Number.MAX_SAFE_INTEGER + 1 },
+ { targetRowsPerFragment: 2 ** 32 },
+ { batchSize: 2 ** 32 },
+ ];
+ it.each(invalid)("rejects invalid settings %p", async (compactionOptions) => {
+ await expect(table.optimize({ compactionOptions })).rejects.toThrow(
+ /safe integer/,
+ );
+ expect(await table.countRows()).toBe(80);
+ });
});
describe.each(arrowVersions)(
diff --git a/nodejs/lancedb/index.ts b/nodejs/lancedb/index.ts
index 0e054d70e..9644b0060 100644
--- a/nodejs/lancedb/index.ts
+++ b/nodejs/lancedb/index.ts
@@ -165,6 +165,7 @@ export {
AddDataOptions,
UpdateOptions,
OptimizeOptions,
+ CompactionOptions,
Version,
WriteProgress,
FtsToken,
diff --git a/nodejs/lancedb/table.ts b/nodejs/lancedb/table.ts
index de22ef0f8..5ef298c8c 100644
--- a/nodejs/lancedb/table.ts
+++ b/nodejs/lancedb/table.ts
@@ -152,7 +152,31 @@ export interface UpdateOptions {
where: string;
}
+/** Per-invocation compaction settings. Values must be safe integers. */
+export interface CompactionOptions {
+ /** Positive target rows per output fragment; also affects candidate selection. */
+ targetRowsPerFragment?: number;
+ /** Positive live-source-row budget across whole tasks; an oversized first task can produce no work. */
+ maxSourceRows?: number;
+ /** Scanner I/O read-ahead budget in bytes; zero disables byte-based I/O backpressure. */
+ ioBufferSize?: number;
+ /** Positive scanner batch size in rows. */
+ batchSize?: number;
+}
+
export interface OptimizeOptions {
+ /**
+ * Compaction settings for this invocation. Omitted remote values inherit table
+ * tuning, then deployment/built-in defaults.
+ * Remote tables require a server supporting these SQL options; settings do
+ * not change table policy. This is not a runtime or total-memory limit.
+ * @example
+ * await tbl.optimize({ compactionOptions: {
+ * targetRowsPerFragment: 1000, maxSourceRows: 5000,
+ * ioBufferSize: 64 * 1024 * 1024, batchSize: 128,
+ * } });
+ */
+ compactionOptions?: CompactionOptions;
/**
* If set then all versions older than the given date
* be removed. The current version will never be removed.
@@ -1047,6 +1071,9 @@ export abstract class Table {
* skipped there instead of being attempted, so this call resolves
* successfully, with zeroed pruning statistics, once the compaction job
* has been submitted; it does not wait for that job to finish.
+ * `compactionOptions` can tune the four per-job settings documented in
+ * {@link CompactionOptions}. Older-server errors are propagated without
+ * retrying with the settings removed.
*/
abstract optimize(options?: Partial): Promise;
/**
@@ -1646,9 +1673,23 @@ export class LocalTable extends Table {
}
async optimize(options?: Partial): Promise {
+ // JavaScript callers can supply extra keys that TypeScript would reject.
+ // Refuse them before the native binding can silently discard a work limit.
+ const supported = new Set([
+ "targetRowsPerFragment",
+ "maxSourceRows",
+ "ioBufferSize",
+ "batchSize",
+ ]);
+ for (const key of Object.keys(options?.compactionOptions ?? {})) {
+ if (!supported.has(key)) {
+ throw new Error(`Unsupported compaction option: ${key}`);
+ }
+ }
return await this.inner.optimize(
options?.cleanupOlderThan?.getTime(),
options?.deleteUnverified,
+ options?.compactionOptions,
);
}
diff --git a/nodejs/src/table.rs b/nodejs/src/table.rs
index 5c3805f51..ebbc4a060 100644
--- a/nodejs/src/table.rs
+++ b/nodejs/src/table.rs
@@ -23,6 +23,63 @@ use crate::merge::NativeMergeInsertBuilder;
use crate::query::{Query, TakeQuery, VectorQuery};
use crate::util::schema_to_buffer;
+/// Per-invocation file-compaction settings. All numbers must be safe integers.
+#[napi(object)]
+pub struct CompactionOptions {
+ pub target_rows_per_fragment: Option,
+ pub max_source_rows: Option,
+ pub io_buffer_size: Option,
+ pub batch_size: Option,
+}
+
+impl CompactionOptions {
+ fn into_overrides(self) -> napi::Result {
+ const MAX_SAFE_INTEGER: u64 = 9_007_199_254_740_991;
+ fn integer(
+ value: Option,
+ name: &str,
+ max: u64,
+ allow_zero: bool,
+ ) -> napi::Result