DocumentationNeurondB Documentation

Quick Start Guide

Prerequisites

Step 1: Create Extension

Enable NeuronDB in your database:

Create extension

CREATE EXTENSION neurondb;

Step 2: Create Vector Table

Create a table with a vector column to store embeddings:

Create vector table

CREATE TABLE articles (
    id SERIAL PRIMARY KEY,
    title TEXT,
    content TEXT,
    embedding vector(384)
);

Step 3: Generate Embeddings

Insert documents with automatically generated embeddings:

Generate embeddings

INSERT INTO articles (title, content, embedding)
VALUES (
    'Machine Learning',
    'Machine learning is a subset of AI',
    embed_text('Machine learning is a subset of AI')
);

Step 4: Create Index

Create an HNSW index for fast similarity search:

Create HNSW index

SELECT hnsw_create_index('articles', 'embedding', 'articles_idx', 16, 200);

Step 5: Search

Perform semantic search using vector similarity:

Semantic search

SELECT id, title,
       embedding <-> embed_text('artificial intelligence') AS distance
FROM articles
ORDER BY distance
LIMIT 5;

Next Steps

Learn More

For detailed documentation, examples, and comprehensive guides, visit: Detailed Documentation