Skip to main content

Quick Start

Get SereneDB running and execute your first search-OLAP query in under five minutes.

Install

docker run -d --name serenedb -p 7890:7890 serenedb/serenedb

Connect

SereneDB speaks the PostgreSQL wire protocol. Connect with psql or any PostgreSQL-compatible client:

psql -h localhost -p 7890

No credentials are required by default.

Create a table

CREATE TABLE articles (
id INTEGER PRIMARY KEY,
title VARCHAR,
body VARCHAR,
category VARCHAR,
published_at DATE,
views INTEGER
);

Insert sample data

INSERT INTO articles VALUES
(1, 'Introduction to Vector Search', 'Vector search enables finding similar items by comparing embeddings in high-dimensional space. It powers recommendation systems and semantic search.', 'engineering', '2025-01-15', 4200),
(2, 'Scaling Analytics Pipelines', 'Modern analytics pipelines must handle billions of rows with sub-second latency. Columnar storage and vectorized execution are key techniques.', 'engineering', '2025-02-20', 3800),
(3, 'Why Unified Search and Analytics Matter', 'Running search and analytics in separate systems creates data silos and synchronization lag. A unified engine eliminates these problems entirely.', 'product', '2025-03-01', 5100),
(4, 'Full-Text Search Best Practices', 'Effective full-text search requires proper analyzers, stemming, and relevance scoring. Position-aware indexing improves phrase matching accuracy.', 'engineering', '2025-03-10', 2900),
(5, 'Real-Time Data Processing at Scale', 'Real-time ingestion combined with instant query availability means dashboards and search results always reflect the latest data without refresh delays.', 'product', '2025-03-15', 6200);

Run an analytics query

Use standard SQL to aggregate and analyze:

SELECT category, COUNT(*) AS articles, AVG(views) AS avg_views
FROM articles
GROUP BY category
ORDER BY avg_views DESC;
 category    | articles | avg_views
-------------+----------+-----------
product | 2 | 5650
engineering | 3 | 3633

Run a search query

This is where SereneDB stands apart. Create a text search dictionary and an inverted index, then search with PHRASE() — all on the same table you just queried analytically.

Set up the index

CREATE TEXT SEARCH DICTIONARY english_dict(
template = 'text',
locale = 'en_US.UTF-8',
case = 'none',
stemming = false,
accent = false,
frequency = true,
position = true
);

CREATE INDEX articles_search_idx ON articles
USING inverted(id, title english_dict, body english_dict);

Find articles mentioning a specific phrase:

SELECT id, title, views
FROM articles_search_idx
WHERE PHRASE(body, 'search and analytics')
ORDER BY views DESC;
 id | title                                  | views
----+----------------------------------------+-------
3 | Why Unified Search and Analytics Matter | 5100

Combine search with analytics in a single query:

SELECT category, COUNT(*) AS matches
FROM articles_search_idx
WHERE PHRASE(body, 'search')
GROUP BY category;
 category    | matches
-------------+---------
engineering | 2
product | 1

Search and analytics, one engine, one query. No data duplication, no synchronization lag.

Next steps

TopicDescription
What Makes SereneDB DifferentUnderstand the architecture behind unified search and analytics
ConceptsLearn about the hybrid storage engine, search and indexing
InstallationExplore all installation options
ReferenceData types, functions and SQL statements