Menu

[RAG / pgvector] How do you handle vector chunks when a document is soft-deleted?

#database#redditdatabase#chunks#vector#delete
Reading 0:00
15s threshold

Hi everyone,

I'm building an ingestion pipeline for a RAG system. My tech stack relies on PostgreSQL for relational data and pgvectore for storing text chunks and performing similarity searches.

I'm facing a design doubt regarding how to handle vector chunks when the parent document undergoes a "soft-delete" (e.g., is_deleted = true in the relational DB).

I've considered two approaches:

Hard-delete the vector chunks: Physically delete all associated chunks from the vector store. If the document is ever restored (which is a rare case i suppose), the only cost is re-generating the embeddings via the API/model.

Soft-delete the chunks as well: Keep the chunks in the vector store and rely on metadata filtering during the hybrid/vector query. My concern here is the risk of hallucinations or performance degradation (as well as being careful to put "where" clauses everywhere basically)

How do you handle this specific issue in production?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.