Principle:AI Northstar Tech Vector io Index Collection Creation
| Knowledge Sources | |
|---|---|
| Domains | Vector_Database, Import, Index_Management |
| Last Updated | 2026-10-15 00:00 GMT |
Overview
A resource management pattern for creating vector database indexes or collections with correct dimensions, distance metrics, and unique naming, including collision avoidance when importing into an existing database.
Description
Index/Collection Creation addresses the problem of provisioning a target index in a vector database before importing data. The pattern involves three concerns:
- Dimension and metric resolution: The target index must be created with the correct vector dimensions and distance metric, as specified in the VDF metadata. If dimensions are unknown (-1), they must be resolved by inspecting the actual vector data in the parquet files.
- Name collision avoidance: When importing into a database that already contains an index with the same name, the pattern provides a create_new_name mechanism that appends incremental numeric suffixes (e.g. "my_index-2", "my_index-3") to ensure uniqueness. This is triggered by the --create_new CLI flag.
- DB-specific creation API: Each vector database has a different API for creating indexes/collections. The actual creation call is DB-specific and implemented in each ImportVDB subclass.
The pattern separates the shared logic (name generation, dimension resolution) from the DB-specific logic (actual API call to create the index), following the Template Method pattern.
Usage
Use this principle when designing systems that need to create indexes or collections in a vector database before importing data. It is suited for:
- Import tools that need to provision target indexes
- Migration tools that create indexes in the destination database
- Systems where index name collisions need to be handled gracefully
Theoretical Basis
The name collision avoidance algorithm:
# Abstract algorithm (NOT real implementation)
def create_new_name(index_name, existing_indexes, delimiter="-"):
if not create_new_flag:
return index_name # Use original name
# Find all suffixes of existing indexes with the same base name
suffixes = []
for name in existing_indexes:
if name.startswith(index_name + delimiter):
suffix = name[len(index_name) + 1:]
if suffix.isdigit():
suffixes.append(int(suffix))
# Determine next suffix
next_suffix = max(suffixes) + 1 if suffixes else 2
# Find first available name
while True:
candidate = f"{index_name}{delimiter}{next_suffix}"
if candidate not in existing_indexes:
return candidate
next_suffix += 1