Skip to content
ParticleDB

Search and memory

An embedding is a numeric vector produced by an embedding model. Generate stored embeddings and query embeddings with the same model and dimensions.

The small vectors below illustrate query behavior. They are not outputs from an embedding model.

CREATE TABLE knowledge (
id BIGINT PRIMARY KEY,
account_id BIGINT,
content TEXT,
embedding VECTOR(3)
);
INSERT INTO knowledge VALUES
(1, 7, 'Deployment guide', '[1,0,0]'),
(2, 7, 'API reference', '[0,1,0]'),
(3, 9, 'Private account note', '[1,0,0]');
SELECT id, content
FROM knowledge
WHERE account_id = 7
ORDER BY embedding <-> '[1,0,0]'
LIMIT 2;

The deployment guide ranks first. Record 3 is excluded by the account filter.

A filter is part of your query, not a complete authorization system. Derive the account scope from authenticated application identity and enforce it on every access path. Security.

Choose a supported index and distance metric using the vector reference. Measure retrieval quality and latency on representative embeddings before choosing index parameters.

Vector search reference · Full-text search · Agent patterns