# DB9 > PostgreSQL-compatible serverless database built on TiKV, designed for AI agents. Instant provisioning, built-in embeddings, file system, HTTP from SQL, branching, and scheduled jobs. ## Documentation Sets - [Complete documentation](https://db9.ai/llms-full.txt): the full documentation for DB9 in a single file - [Abridged documentation](https://db9.ai/llms-small.txt): compact version with non-essential content removed ## Start Here - [What is DB9?](https://db9.ai/docs/overview.md): DB9 is a PostgreSQL-compatible serverless database built on TiKV, designed for AI agents and developers who need instant provisioning, built-in embeddings, a file system, HTTP from SQL, branching, and scheduled jobs — all inside one database. - [Why DB9 for AI Agents](https://db9.ai/docs/why-db9-for-ai-agents.md): DB9 gives AI agents a full database toolkit — instant provisioning, built-in embeddings, a queryable file system, HTTP from SQL, branching, and scheduled jobs — all accessible through standard PostgreSQL. - [Quick Start](https://db9.ai/docs/quickstart.md): Get started with DB9 in under a minute — install the CLI or TypeScript SDK and create your first database. - [Connect to DB9](https://db9.ai/docs/connect.md): How to connect to a DB9 database — connection strings, psql, ORMs, drivers, the TypeScript SDK, authentication options, and TLS. - [Architecture](https://db9.ai/docs/architecture.md): How DB9 works — the control plane, data plane, TiKV storage, pgwire protocol, SQL execution pipeline, multi-tenant isolation, and extension system. - [Production Checklist](https://db9.ai/docs/production-checklist.md): Minimum guidance for running DB9 in production — authentication, secrets, connection management, branching strategy, observability, recovery expectations, and operational limits. ## Agent Workflows - [DB9 with Claude Code](https://db9.ai/docs/agent-workflows/claude-code.md): Give Claude Code full database capabilities — create, query, branch, and manage DB9 databases from natural language prompts. - [Install DB9 Skills](https://db9.ai/docs/agent-workflows/install-db9-skills.md): Use db9 onboard to install the DB9 skill into Claude Code, OpenAI Codex, OpenCode, and other coding agents. - [DB9 with OpenAI Codex](https://db9.ai/docs/agent-workflows/openai-codex.md): Give OpenAI Codex CLI full database capabilities — create, query, branch, and manage DB9 databases from natural language prompts. - [Agent Workflows](https://db9.ai/docs/agent-workflows/overview.md): How AI agents use DB9 as a programmable backend — provisioning, storing, searching, calling APIs, branching, and scheduling through standard SQL. ## Tutorials - [AI Coding Prompts](https://db9.ai/docs/guides/ai-prompts.md): Pre-built LLM prompts for 10+ tech stack combinations — copy and paste into Claude Code, Cursor, Copilot, or any AI assistant to generate DB9 integration code. - [Analyze Agent Logs with fs9](https://db9.ai/docs/guides/analyze-agent-logs-with-fs9.md): Store and query agent logs as files inside DB9 using the fs9 extension — parse JSONL, aggregate tool calls, and measure run durations with standard SQL. - [Astro](https://db9.ai/docs/guides/astro.md): Use Astro with DB9 — connect from server endpoints and SSR pages using Prisma, Drizzle, or node-postgres. - [Branching Workflows](https://db9.ai/docs/guides/branching-workflows.md): Use DB9 database branches for preview environments, safe schema changes, test isolation, and rollback — with isolated branches that don't affect production. - [CI Ephemeral Databases](https://db9.ai/docs/guides/ci-ephemeral-databases.md): Use disposable DB9 databases in CI pipelines — create per-run databases or branches, run tests against real PostgreSQL, and clean up automatically. - [Django](https://db9.ai/docs/guides/django.md): Use Django with DB9 — connect with Django ORM over standard PostgreSQL, define models, run migrations, and build views. - [Express / Hono](https://db9.ai/docs/guides/express.md): Use Express or Hono with DB9 — build a Node.js API connected to DB9 using Prisma, Drizzle, or node-postgres. - [Flask](https://db9.ai/docs/guides/flask.md): Use Flask with DB9 — connect with SQLAlchemy over standard PostgreSQL, define models, and build API routes. - [HTTP from SQL](https://db9.ai/docs/guides/http-from-sql.md): Call external APIs, webhooks, and services directly from SQL using DB9's built-in http extension — with security boundaries, timeouts, and rate limits. - [Laravel](https://db9.ai/docs/guides/laravel.md): Use Laravel with DB9 — connect with Eloquent over standard PostgreSQL, define models, run migrations, and build controllers. - [Nuxt](https://db9.ai/docs/guides/nuxt.md): Use Nuxt with DB9 — connect from server routes and API handlers using Prisma, Drizzle, or node-postgres. - [RAG with Built-in Embeddings](https://db9.ai/docs/guides/rag-with-built-in-embeddings.md): Build a retrieval-augmented generation pipeline using DB9's native embedding() function and vector search — no external embedding service needed. - [Rails](https://db9.ai/docs/guides/rails.md): Use Ruby on Rails with DB9 — connect with ActiveRecord over standard PostgreSQL, define models, run migrations, and build controllers. - [Remix](https://db9.ai/docs/guides/remix.md): Use Remix with DB9 — connect from loaders and actions using Prisma, Drizzle, or node-postgres. - [Scheduled Jobs with pg_cron](https://db9.ai/docs/guides/scheduled-jobs-with-pg-cron.md): Set up periodic SQL jobs in DB9 using pg_cron — schedule cleanup tasks, API polling, data syncs, and monitor execution history. - [SvelteKit](https://db9.ai/docs/guides/sveltekit.md): Use SvelteKit with DB9 — connect from server load functions and form actions using Prisma, Drizzle, or node-postgres. ## Integrations - [Next.js](https://db9.ai/docs/guides/nextjs.md): Use Next.js with DB9 — connect from Server Components, Route Handlers, and Server Actions using Prisma, Drizzle, or node-postgres. - [Prisma](https://db9.ai/docs/guides/prisma.md): Use Prisma ORM with DB9 — connection setup, schema definition, CRUD operations, transactions, raw SQL for advanced features, and vector search. - [Drizzle](https://db9.ai/docs/guides/drizzle.md): Use Drizzle ORM with DB9 — type-safe schema definitions, queries, transactions, raw SQL for advanced features, and vector search. - [SQLAlchemy](https://db9.ai/docs/guides/python-sqlalchemy.md): Use SQLAlchemy 2.0 with DB9 — ORM models, CRUD, transactions, vector search, full-text search, and hybrid retrieval over pgwire. - [TypeORM](https://db9.ai/docs/guides/typeorm.md): Use TypeORM with DB9 — decorator-based entities, repository pattern, QueryBuilder, relations, transactions, and vector search. - [Sequelize](https://db9.ai/docs/guides/sequelize.md): Use Sequelize with DB9 — model definitions, associations, CRUD with operators, transactions, raw SQL, and vector search. - [Knex.js](https://db9.ai/docs/guides/knex.md): Use Knex.js with DB9 — query builder, schema builder, transactions, raw SQL, and vector search. - [GORM](https://db9.ai/docs/guides/gorm.md): Use GORM with DB9 — Go struct models, AutoMigrate, CRUD, transactions, raw SQL, and vector search over pgwire. ## Platform - [Anonymous and Claimed Databases](https://db9.ai/docs/platform/anonymous-and-claimed-databases.md): How DB9's zero-setup trial works — anonymous accounts, database limits, claiming with SSO, and what happens to your data when you upgrade. - [Compatibility Matrix](https://db9.ai/docs/platform/compatibility-matrix.md): What DB9 supports, partially supports, and does not support compared to PostgreSQL — covering SQL, data types, indexes, protocol, ORMs, extensions, and system catalogs. - [Limits and Quotas](https://db9.ai/docs/platform/limits-and-quotas.md): All DB9 limits in one place — connections, queries, extensions, storage, branching, and account quotas. - [Multi-Tenant Patterns](https://db9.ai/docs/platform/multi-tenant-patterns.md): How to structure DB9 databases for multi-tenant workloads — database-per-user, database-per-app, ephemeral-per-task, and branch-per-preview. - [Observability](https://db9.ai/docs/platform/observability.md): What you can see in DB9 today — query sampling, slow query detection, latency percentiles, schema introspection, and what's not yet available. - [Provisioning](https://db9.ai/docs/platform/provisioning.md): How to create, manage, and delete DB9 databases programmatically — through the CLI, TypeScript SDK, or REST API. - [Recovery and Branch Lifecycle](https://db9.ai/docs/platform/recovery-and-branch-lifecycle.md): Database states, branch lifecycle, deletion behavior, automatic recovery, and what DB9 does and does not provide for backup and disaster recovery. - [Security and Auth](https://db9.ai/docs/platform/security-and-auth.md): DB9's authentication layers, token types, role model, credential storage, and security boundaries — what is protected, how, and what is not. - [Storage Accounting](https://db9.ai/docs/platform/storage.md): Monitor database and table storage usage with virtual tables and automatic background scans. ## Migrate - [Migrate from Amazon RDS](https://db9.ai/docs/migrations/from-amazon-rds.md): Move your database from Amazon RDS for PostgreSQL to DB9 — export with pg_dump, import with the DB9 CLI, and update your application's connection string. - [Migrate from Firebase](https://db9.ai/docs/migrations/from-firebase.md): Move your database from Firebase (Firestore or Realtime Database) to DB9 — export your data, design a relational schema, and import with the DB9 CLI. - [Migrate from Heroku Postgres](https://db9.ai/docs/migrations/from-heroku.md): Move your database from Heroku Postgres to DB9 — export with pg_dump, import with the DB9 CLI, and update your application's connection string. - [Migrate from Neon](https://db9.ai/docs/migrations/from-neon.md): Move your database from Neon to DB9 — export with pg_dump, import with the DB9 CLI, and update your application's connection string. - [Migrate from PlanetScale](https://db9.ai/docs/migrations/from-planetscale.md): Move your database from PlanetScale (MySQL/Vitess) to DB9 — export your schema and data, convert from MySQL to PostgreSQL, and import with the DB9 CLI. - [Migrate from PostgreSQL](https://db9.ai/docs/migrations/from-postgres.md): Move a self-hosted or managed PostgreSQL database to DB9 — export with pg_dump, verify compatibility, import with the DB9 CLI, and validate. - [Migrate from Railway](https://db9.ai/docs/migrations/from-railway.md): Move your database from Railway PostgreSQL to DB9 — export with pg_dump, import with the DB9 CLI, and update your application's connection string. - [Migrate from Supabase](https://db9.ai/docs/migrations/from-supabase.md): Move your database layer from Supabase to DB9 — export with pg_dump, import with the DB9 CLI, and replace Supabase-specific features with standard PostgreSQL patterns. - [Migrate from Turso](https://db9.ai/docs/migrations/from-turso.md): Move your database from Turso (libSQL/SQLite) to DB9 — export your data, convert from SQLite to PostgreSQL, and import with the DB9 CLI. ## Compare - [DB9 vs Neon](https://db9.ai/docs/comparisons/db9-vs-neon.md): A fair comparison of DB9 and Neon — when each is the better choice for your PostgreSQL workload, and where they differ on architecture, branching, extensions, and developer experience. - [DB9 vs PlanetScale](https://db9.ai/docs/comparisons/db9-vs-planetscale.md): A fair comparison of DB9 and PlanetScale Postgres — when each is the better choice for your PostgreSQL workload, and where they differ on architecture, extensions, and developer experience. - [DB9 vs Supabase](https://db9.ai/docs/comparisons/db9-vs-supabase.md): A fair comparison of DB9 and Supabase — database-only vs full application platform, and when each is the right choice. - [DB9 vs Turso](https://db9.ai/docs/comparisons/db9-vs-turso.md): A fair comparison of DB9 and Turso — when each is the better choice, and where they differ on SQL dialect, architecture, edge replication, and developer experience. ## Reference - [CLI Reference](https://db9.ai/docs/cli.md): Complete reference for the db9 command-line tool — installation, authentication, database management, SQL, filesystem, filesystem watch, branching, serverless functions, and agent onboarding. - [REST API Reference](https://db9.ai/docs/api.md): Complete reference for the DB9 Customer REST API — authentication, databases, SQL execution, filesystem, branching, users, tokens, and more. - [TypeScript SDK](https://db9.ai/docs/sdk.md): Complete API reference for the get-db9 TypeScript SDK — provisioning, SQL, filesystem, branching, auth lifecycle, and all exported interfaces. - [Browser SDK](https://db9.ai/docs/sdk-browser.md): API reference for the @db9/browser TypeScript SDK — query databases from client-side code with Row-Level Security, publishable keys, and a chainable query builder. ## SQL Reference - [Advanced SQL](https://db9.ai/docs/sql/advanced.md): PL/pgSQL, sequences, triggers, and other advanced SQL features in DB9. - [Authentication & Roles](https://db9.ai/docs/sql/auth.md): Connection format, TLS, and role-based access control in DB9. - [System Catalog](https://db9.ai/docs/sql/catalog.md): System views for introspecting database objects in DB9. - [Data Types](https://db9.ai/docs/sql/data-types.md): All 24 data types supported by the DB9 SQL engine, including type coercion rules and cast contexts. - [DDL — Data Definition](https://db9.ai/docs/sql/ddl.md): Data Definition Language statements for creating and managing database objects in DB9. - [DML & Queries](https://db9.ai/docs/sql/dml.md): Data Manipulation Language (INSERT, UPDATE, DELETE) and query features (SELECT, JOIN, CTEs, window functions, set operations) in DB9. - [Built-in Functions](https://db9.ai/docs/sql/functions.md): Comprehensive reference of all built-in functions in DB9, organized by category. - [Limits & Constraints](https://db9.ai/docs/sql/limits.md): Resource limits and constraints across the DB9 engine and extensions. - [Row-Level Security](https://db9.ai/docs/sql/rls.md): Row-Level Security (RLS) in DB9 — enable per-row access control with policies, roles, and the browser SDK. - [Session Parameters](https://db9.ai/docs/sql/session.md): Session-level configuration with SET/SHOW in DB9. - [Transactions & COPY](https://db9.ai/docs/sql/transactions.md): Transaction control, savepoints, isolation semantics, autocommit behavior, and bulk data import/export with COPY. ## Extensions - [CHUNK_TEXT — Document Chunking](https://db9.ai/docs/extensions/chunk-text.md): Split documents into overlapping chunks for RAG pipelines using the CHUNK_TEXT table-valued function — with smart markdown-aware splitting. - [fs9 — File System](https://db9.ai/docs/extensions/fs9.md): Read, write, query, and watch files from SQL using the fs9 extension — with directory listing, glob matching, format auto-detection, event notifications, and a WebSocket API for programmatic access. - [Full-Text Search](https://db9.ai/docs/extensions/fts.md): Full-text search with language-specific tokenizers including jieba for Chinese and simple for English. - [hstore — Key-Value](https://db9.ai/docs/extensions/hstore.md): PostgreSQL-compatible key-value store type for client compatibility — use JSONB for new code. - [http — HTTP Client](https://db9.ai/docs/extensions/http.md): Make HTTP requests directly from SQL — GET, POST, PUT, DELETE, HEAD, and PATCH. - [Parquet Import](https://db9.ai/docs/extensions/parquet.md): Import Parquet files into DB9 tables via COPY FROM with HTTP URL support. - [pg_cron — Scheduled Tasks](https://db9.ai/docs/extensions/pg-cron.md): Schedule SQL statements to run on a cron schedule — with upsert, job management, execution history, and CLI support. - [uuid-ossp](https://db9.ai/docs/extensions/uuid.md): Generate universally unique identifiers (UUIDs) in SQL — v4 random and v7 time-ordered. - [Vector Search](https://db9.ai/docs/extensions/vector.md): Store vector embeddings, build HNSW indexes, and run k-NN similarity search — with optional built-in embedding generation directly in SQL.