Skip to main content
These actions apply to a ParadeDB index with a vector field. The general advice in Index Creation and Write Throughput applies as well.

Building a Large Index

CREATE INDEX and REINDEX on a vector column group the vectors into clusters and compress them, which takes more CPU and memory than a text-only build. Load the data first, then create the index.

Workers

The build uses the leader plus up to max_parallel_maintenance_workers workers, within max_parallel_workers and max_worker_processes.

Memory

maintenance_work_mem is divided evenly among the build processes, including the leader. Each process uses up to 1 GiB of its share and needs at least 15 MB. As a starting point, give each process 1 GiB:

Progress

pg_stat_progress_create_index shows the current phase:
Row counters pause during the training and clustering phases. This is normal: they are the most CPU-intensive steps. A build that takes a minute or longer ends with a NOTICE summarizing rows, segments, size, and time. Troubleshooting lists the other messages a build can print.

Writes and Merges

A vector index stays correct as rows are inserted, updated, and deleted, with no rebuild. Newly written rows are not clustered. A query compares against each of them, which is exact and costs time in proportion to how many there are. Background merging combines them into larger segments and clusters them. Keep it enabled. To see how much of an index is clustered:
ivf rows are clustered and flat rows are not. An index answers fastest when nearly all of its vectors are in ivf segments.

When to Rebuild

Routine writes do not require a rebuild. Run REINDEX in these cases:
To change the distance metric, drop the index and create it with a different operator class. REINDEX keeps the existing one.