lancedb-optimize

Compact and prune LanceDB tables to merge fragments and reclaim storage.

2|Updated Jun 18, 2026
One-click install
npx skills add https://github.com/zero-yx/static_flow --skill lancedb-optimize-zero-yx
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: lancedb-optimize
Source: https://github.com/zero-yx/static_flow/tree/main/skills/lancedb-optimize
Command: npx skills add https://github.com/zero-yx/static_flow --skill lancedb-optimize-zero-yx

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Over time, LanceDB tables accumulate fragment files from writes and imports, causing "Too many open files" errors, wasted disk space, and slower queries. This Skill runs a structured maintenance workflow to compact and prune every table across StaticFlow's content, comments, and music databases. ## Core Features & Use Cases - Pre-check Fragment Audit: Inspects fragment counts per table via audit-storage so only tables needing compaction are optimized. - Full Optimization: Runs optimize <table> --all --prune-now to merge fragments, rebuild indexes, and immediately remove old versions. - Post-check Verification: Re-audits fragments and compares row counts before and after to confirm data integrity. - Use Case: After a bulk article import triggers "os error 24" on the backend, run this Skill to compact all affected LanceDB tables and verify row counts remain unchanged. ## Quick Start Optimize all LanceDB tables across the content, comments, and music databases and report before-and-after fragment counts.

Frequently Asked Questions about lancedb-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compact LanceDB tables to reduce fragment files?▼

Run `sf-cli db --db-path <db_path> optimize <table> --all --prune-now` for each table. The --all flag compacts fragments and rebuilds indexes, while --prune-now immediately removes old versions.

How to fix LanceDB "Too many open files" os error 24?▼

This error occurs when accumulated fragment files exhaust file descriptors. Compact the affected tables with the optimize command to merge fragments, which reduces open file handles and restores normal operation.

Does LanceDB optimization delete or lose table data?▼

No, optimization is non-destructive. It merges fragments and removes old versions but never deletes current data. Verify integrity by comparing row counts with `count-rows` before and after optimization.

Can I run LanceDB optimization while the backend is writing?▼

Light writes from normal API traffic are fine, but heavy write activity should be avoided to prevent lock contention. Tables within the same database must be optimized sequentially since they share a lock.

When should I skip optimizing a LanceDB table?▼

Skip tables with three or fewer fragments, as they are already compact. Use `audit-storage --table <table>` to check fragment counts before deciding which tables need optimization.