Skip to content
Discord Get Started

What is DB9?

DB9 is a PostgreSQL-compatible serverless database built on TiKV. It speaks the PostgreSQL wire protocol, so any tool that connects to Postgres — psql, Prisma, Drizzle, SQLAlchemy, or a raw driver — connects to DB9 with no adapter needed.

What makes DB9 different is what ships inside the database: vector search and built-in embeddings, a queryable file system (fs9), HTTP calls from SQL, scheduled jobs via pg_cron, and zero-copy branching. These capabilities are compiled into the server, not bolted on through external services.

AI agents and agent frameworks. An agent can provision a database in under a second using the CLI or TypeScript SDK, store structured data alongside embeddings and files, call external APIs from SQL, and tear the database down when the task is done — all without leaving the SQL layer.

Developers building with ORMs and frameworks. If you use Prisma, Drizzle, TypeORM, Sequelize, Knex, or SQLAlchemy, DB9 works as your Postgres backend with no driver changes. You get instant creation and branching on top of the ORM workflow you already have.

Teams that need disposable or per-tenant databases. DB9 provisions databases programmatically, so patterns like database-per-user, database-per-test-run, or ephemeral preview databases are first-class, not workarounds.

Create a database in under a second with zero configuration. No signup is required — anonymous trial databases work immediately:

Terminal
db9 create myapp

Or from TypeScript:

TypeScript
import { instantDatabase } from 'get-db9';
const db = await instantDatabase({ name: 'myapp' });
console.log(db.connectionString);

DB9 includes a pgvector-compatible vector type with HNSW indexing, plus a built-in embedding() function that generates and caches embeddings without external infrastructure. Enable it once per database with CREATE EXTENSION embedding:

SQL
-- Generate an embedding and store it
INSERT INTO docs (content, vec)
VALUES ('DB9 overview', embedding('DB9 overview')::vector);
-- Semantic search
SELECT content
FROM docs
ORDER BY vec <-> embedding('search query')::vector
LIMIT 5;

Store and query files — CSV, JSONL, Parquet — directly from SQL:

SQL
-- Read a CSV file as a table
SELECT * FROM fs9('/data/users.csv');
-- Copy local files into the database filesystem
-- (via CLI: db9 fs cp ./report.csv myapp:/data/report.csv)

The file system is also accessible as an interactive shell (db9 fs sh myapp) or a FUSE mount.

Call external APIs without leaving a SQL query:

SQL
SELECT * FROM http('https://api.example.com/data');

Supports GET, POST, PUT, and DELETE. Useful for enrichment pipelines, webhook triggers, and agent tool integrations.

Create a branch of any database for safe testing, preview environments, or rollback points:

Terminal
db9 db branch create myapp --name preview

Branches are lightweight copies. They share history with the parent but diverge on write.

Run periodic SQL inside the database with no external scheduler:

SQL
SELECT cron.schedule('refresh-stats', '*/5 * * * *', 'REFRESH MATERIALIZED VIEW stats');

Manage jobs via SQL or the CLI (db9 db cron list myapp).

Migrations, type generation, and observability

Section titled “Migrations, type generation, and observability”
  • Migrations: version-controlled SQL files applied with db9 migration up.
  • Type generation: db9 gen types myapp --lang typescript produces type definitions from live schema.
  • Observability: db9 db inspect myapp shows query samples, slow queries, schemas, tables, and indexes.
  • You need a Postgres-compatible database that provisions instantly for agents, tests, or per-tenant isolation.
  • You want vector search, file ingestion, HTTP calls, and cron in one database instead of separate services.
  • You are building AI agent workflows where the database is a tool the agent creates, uses, and discards.
  • You want branching for preview environments or safe schema experiments.
  • You need a full application platform with auth, storage, edge functions, and a dashboard (consider Supabase).
  • Your workload depends on PostgreSQL extensions that DB9 does not yet support — check the extensions overview and SQL limits first.
  • You need an on-premises or self-hosted deployment today.

DB9 separates the control plane from the data plane:

  • Control plane — the API server, CLI, and SDK handle database creation, user management, token lifecycle, branching, and observability. You interact with it through db9 commands or the TypeScript SDK.
  • Data plane — the db9-server process speaks the PostgreSQL wire protocol and executes SQL against TiKV. Each database gets its own isolated keyspace in TiKV, so tenants share infrastructure but never data.

Extensions like fs9, HTTP, embedding, vector, and pg_cron run inside the data plane as compiled-in capabilities, not separate microservices.

For a deeper look, see the Architecture page.

  • Why DB9 for AI Agents — the agent-native capabilities that make DB9 different
  • Connect to DB9 — connection strings, psql, ORMs, drivers, and authentication
  • Quick Start — install the CLI and create your first database in under a minute
  • CLI Reference — full command reference for db9
  • TypeScript SDKinstantDatabase(), client API, and credential management
  • Extensions — fs9, HTTP, pg_cron, vector search, full-text search, and more
  • SQL Reference — data types, DDL/DML, functions, and compatibility notes