-- Phase 35: RAG ivfflat 向量索引
-- 前提: rag_chunks 已有 2582+ chunks
-- 執行: psql awoooi_prod
-- 2026-04-10 Claude Sonnet 4.6 Asia/Taipei

CREATE INDEX IF NOT EXISTS idx_rag_chunks_embedding
  ON rag_chunks
  USING ivfflat (embedding vector_cosine_ops)
  WITH (lists = 100);

-- 驗證
SELECT indexname, indexdef
FROM pg_indexes
WHERE tablename = 'rag_chunks' AND indexname = 'idx_rag_chunks_embedding';
