16 lines
558 B
SQL
16 lines
558 B
SQL
CREATE UNIQUE INDEX IF NOT EXISTS ux_items_ns_key
|
|
ON memory_items(namespace_id, key)
|
|
WHERE key IS NOT NULL;
|
|
|
|
CREATE INDEX IF NOT EXISTS ix_chunks_item ON memory_chunks(item_id);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_chunks_content_tsv
|
|
ON memory_chunks USING GIN(content_tsv);
|
|
|
|
CREATE INDEX IF NOT EXISTS ix_embed_model_dim ON embeddings(model, dim);
|
|
|
|
-- per-model ANN index (duplicate with each concrete model name)
|
|
CREATE INDEX IF NOT EXISTS ix_embed_vec_model_default
|
|
ON embeddings USING ivfflat (vector vector_cosine_ops)
|
|
WHERE model = 'default-emb';
|