@lancedb/lancedb • Docs
@lancedb/lancedb / OptimizeOptions
Interface: OptimizeOptions¶
Properties¶
cleanupOlderThan¶
If set then all versions older than the given date be removed. The current version will never be removed. The default is 7 days
Example¶
// Delete all versions older than 1 day
const olderThan = new Date();
olderThan.setDate(olderThan.getDate() - 1));
tbl.optimize({cleanupOlderThan: olderThan});
// Delete versions committed before this point. Versions created by the
// optimize call itself are newer than the cutoff and will be retained.
tbl.optimize({cleanupOlderThan: new Date()});
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¶
await tbl.optimize({ compactionOptions: {
targetRowsPerFragment: 1000, maxSourceRows: 5000,
ioBufferSize: 64 * 1024 * 1024, batchSize: 128,
} });
deleteUnverified¶
Because they may be part of an in-progress transaction, files newer than
7 days old are not deleted by default. If you are sure that there are no
in-progress transactions, then you can set this to true to delete all
files older than cleanupOlderThan.
WARNING: This should only be set to true if you can guarantee that no other process is currently working on this dataset. Otherwise the dataset could be put into a corrupted state.