Skip to content

Upsert

A database operation that inserts a new vector if it does not exist or updates it if it does, identified by a unique ID.

Upsert is a database operation that inserts a new record if it does not already exist, or updates the existing one if it does — a blend of update and insert. Each record is identified by a unique ID, and the upsert either creates it or overwrites it depending on whether that ID is already present.

In a vector database, upsert is the natural way to keep data in sync with a changing source. When a document is added or modified, you upsert its vector under a stable ID: the first time it creates the entry, and on subsequent changes it replaces the old vector with the new one. This avoids having to check existence and choose between insert and update yourself, and prevents duplicate entries for the same item.

Upsert is fundamental to maintaining a fresh index. As source content evolves, re-embedding changed items and upserting them keeps the searchable vectors current without rebuilding the whole index. Combined with real-time indexing, upserts let a vector database continuously reflect the latest state of the underlying data, which is essential for applications where content updates frequently.