Kenneth Oh
05/15/2026, 6:26 PMRocky
05/15/2026, 6:26 PMstarrocks/cn-ubuntu images typically follow the main release cycle. Once the feature is merged into a stable or beta release for shared-data, it will be available in the corresponding Docker image tag.
Summary of Supported Indexes (Shared-data)
If you are using a shared-data cluster on v4.1 or later, you can currently use:
* Built-in Inverted Index: Supported in shared-data clusters since v4.1 (Beta) for text filtering and full-text search.
* Bitmap / Bloom Filter / Prefix Indexes: Standard support across both architectures.
For the most up-to-date schedule, I recommend monitoring the StarRocks GitHub Roadmap or the official release notes.
References
• deployment/shared_data/feature-support-shared-data.md
• table_design/indexes/vector_index.md
• table_design/indexes/inverted_index.md
• faq/shared_data_faq.mdKenneth Oh
05/15/2026, 6:27 PMRocky
05/15/2026, 6:28 PMstarrocks/cn-ubuntu images for the v4.2.0-rc or v4.2.0 tags will be the first to officially support this. If you need it sooner, it may appear in dev or nightly tags once the build-path PRs are merged.
Summary of Limitations (As of v4.1)
Until the full shared-data implementation is released:
1. Architecture: Vector indexes (HNSW/IVFPQ) remain restricted to shared-nothing (Local Storage) clusters.
2. Alternative: For shared-data clusters on v4.1, you can use the Inverted Index for text-based search, but it does not support vector similarity (ANN) yet.
Recommendation: Keep an eye on the StarRocks v4.2 Release Plan or the specific PR #72926 to track when the "write" portion of the feature is finalized.Kenneth Oh
05/15/2026, 6:32 PMRocky
05/15/2026, 6:32 PMl2_distance(array1, array2)
* Cosine Similarity: cosine_similarity(array1, array2)
Example Query:
sql
SELECT id, l2_distance([0.1, 0.2, 0.3], vector_column) as dist
FROM my_table
WHERE category = 'electronics' -- Pre-filter to reduce scan
ORDER BY dist ASC
LIMIT 10;
2. Enable and Tune the Data Cache
In shared-data clusters, the bottleneck for brute-force vector search is often the latency of reading data from object storage (S3/GCS).
* Recommendation: Ensure Data Cache is enabled on your Compute Nodes (CN). This stores frequently accessed vector data on local NVMe/SSD, allowing brute-force scans to run at near-local speeds.
* Tip: If you have a specific "hot" dataset for vector search, ensure the CN nodes have enough disk space to keep the entire vector column in the cache.
3. Pre-Filtering (Hybrid Search)
The most effective way to speed up search without a vector index is to reduce the number of rows being scanned.
* Scalar Filtering: Use standard columns (like user_id, timestamp, or category) in your WHERE clause.
* Inverted Indexes (v4.1+): Since shared-data clusters now support the Built-in Inverted Index, you can use it for high-performance text filtering. By filtering rows based on keywords before calculating vector distances, you can drastically reduce the compute load.
4. Manual "Coarse" Clustering (Advanced Workaround)
If you have billions of rows and cannot wait for v4.2, you can implement a manual version of the IVF (Inverted File) logic:
1. Generate Clusters: Use an external tool (like Scikit-learn or Faiss) to pre-calculate $K$ cluster centroids for your embeddings.
2. Assign IDs: When loading data into StarRocks, include a cluster_id column for each row (the ID of the nearest centroid).
3. Two-Step Search:
* Find the nearest centroids to your query vector.
* Query StarRocks only for rows where cluster_id matches those nearest centroids.
* This effectively simulates an IVF index, reducing a global scan to a targeted scan of specific clusters.
Summary of Current Roadmap
* v4.1 (Available now): Inverted Index support for shared-data (useful for pre-filtering).
* v4.2 (Upcoming): Native HNSW and IVFPQ support for shared-data clusters, which will automate the acceleration you are-mentioned "Coarse Clustering" and Search" and provide much higher performance with less manual effort.
References
• table_design/indexes/vector_index.md
• table_design/indexes/inverted_index.mdKenneth Oh
05/15/2026, 6:39 PMRocky
05/15/2026, 6:40 PMARRAY<FLOAT> and use precise distance functions. These queries are parallelized and accelerated by the StarRocks SIMD-vectorized execution engine.
1. Creating the Table
When creating a table in a shared-data cluster, ensure you enable the Data Cache. This keeps embedding data on the local NVMe of your Compute Nodes (CN), drastically speeding up the brute-force scans.
sql
CREATE TABLE product_embeddings (
product_id BIGINT NOT NULL,
category STRING,
embedding ARRAY<FLOAT> NOT NULL
)
ENGINE=OLAP
DUPLICATE KEY(product_id)
DISTRIBUTED BY HASH(product_id)
PROPERTIES (
"datacache.enable" = "true", -- Crucial for performance in shared-data
"datacache.partition_duration" = "1 MONTH"
);
2. Hybrid Lakehouse Queries (JOINs)
StarRocks allows you to join local vector tables with typical lakehouse data (e.g., Iceberg/Hive) or other OLAP tables.
Example: Join local embeddings with an Iceberg table to filter by user preferences
sql
-- Querying a local table and joining with an external Iceberg catalog
SELECT
p.product_id,
i.product_name,
l2_distance(p.embedding, [0.1, 0.5, 0.8]) as dist
FROM product_embeddings p
JOIN iceberg_catalog.sales_db.product_metadata i ON p.product_id = i.id
WHERE i.status = 'active' -- Filter on Lakehouse data
AND p.category = 'electronics' -- Filter on local metadata
ORDER BY dist ASC
LIMIT 10;
──────────
Phase 2: Migration Plan for StarRocks v4.2 (HNSW)
Once you upgrade to v4.2, follow this plan to move from brute-force scans to indexed Approximate Nearest Neighbor Search (ANNS).
1. Add the Index (Metadata Update)
You won't need to recreate your table. You can add the index via an ALTER statement. This will trigger an asynchronous index build in the background.
sql
-- Migration Step: Add the HNSW index to your existing column
ALTER TABLE product_embeddings
ADD INDEX idx_vector (embedding) USING VECTOR (
"index_type" = "hnsw",
"metric_type" = "l2_distance",
"dim" = "1536" -- Dimension must match your embedding
);
-- Monitor build progress
SHOW ALTER TABLE COLUMN FROM product_embeddings;
2. Update Query Syntax
To trigger the index, you must switch from precise functions to their "approximate" counterparts. The index will not be used unless you use the approx_ functions and include a LIMIT clause.
Current (v4.1) | Migrated (v4.2+)
l2_distance() | approx_l2_distance()
cosine_similarity() | approx_cosine_similarity()
Updated Query:
sql
SELECT product_id, approx_l2_distance(embedding, [...]) as dist
FROM product_embeddings
ORDER BY dist ASC
LIMIT 10;
3. Tuning for Production
After migration, use session variables or hints to tune the recall (accuracy) vs. speed tradeoff. HNSW uses the efsearch parameter.
sql
SELECT /*+ SET_VAR(ann_params='{efsearch=128}') */
product_id,
approx_l2_distance(embedding, [...]) as dist
FROM product_embeddings
ORDER BY dist ASC
LIMIT 10;
Summary of Differences
* Storage: No change (both use ARRAY<FLOAT>).
* Compute: v4.1 uses brute-force (fully parallelized); v4.2 uses the HNSW graph to skip data scans.
* Infrastructure: For both versions, Ensure your starrocks/cn-ubuntu containers have sufficient storage_root_path disk space to cache the embeddings.
ReferencesRocky
05/15/2026, 6:40 PM