PostgreSQL Schema Design for GraphRAG
Recommended PostgreSQL schema patterns for storing documents, embeddings, entities, and relationships.
Industry Best Practice2025
Recommended schema includes: documents table (id, title, source_url, content, metadata JSONB), chunks table (id, document_id FK, chunk_index, content, embedding vector(1536), content_tsv tsvector), entities table (id, name, type, description, embedding), relationships table (source_entity_id, target_entity_id, type, description, weight), and communities table (id, level, title, summary, summary_embedding). Use UUID primary keys, JSONB for metadata, HNSW indexes on embeddings, and generated tsvector columns.
Tags
schemadatabase-designembeddingspostgresqlproduction