tinySQL DBMS Daemon (tinysqld)

June 21, 2026 ยท View on GitHub

tinysqld is the future enterprise DBMS entry point. It is intentionally separate from the existing cmd/server command so current HTTP/gRPC server behavior remains compatible while the DBMS runtime grows.

Current Scope

  • Opens the OpenEnterprise product profile.
  • Requires durable storage.
  • Starts the job scheduler through the enterprise profile.
  • Exposes a minimal HTTP DBMS API.
  • Reports DB health, storage, scheduler, WAL, and recovery state.
  • Waits for a shutdown signal and shuts down gracefully.

Use cmd/server for the older HTTP/gRPC API server while tinysqld grows into the enterprise DBMS entry point.

Build

go build ./cmd/tinysqld

Run

./tinysqld -data ./tinysqld-data -storage disk -tenant default -http 127.0.0.1:8088

Check Configuration

./tinysqld -data ./tinysqld-data -storage disk -check

Flags

  • -data: durable database path or directory.
  • -storage: storage mode; one of disk, hybrid, index, wal, advanced_wal.
  • -tenant: default tenant, default if omitted.
  • -http: HTTP listen address, 127.0.0.1:8088 by default. Empty disables HTTP.
  • -auth: optional bearer token for API endpoints.
  • -request-timeout: maximum SQL request duration.
  • -http-read-timeout: HTTP read timeout.
  • -http-write-timeout: HTTP write timeout.
  • -shutdown-timeout: graceful shutdown timeout.
  • -check: open the runtime, print status, then exit.

HTTP API

Unauthenticated:

  • GET /healthz: DB health snapshot; returns 503 if storage is closed or closing.
  • GET /readyz: readiness plus health; returns 503 while not ready or unhealthy.

Authenticated when -auth is set:

  • GET /api/status: runtime status, backend stats, and DB health.
  • POST /api/exec
  • POST /api/query
  • GET /api/catalog/tables
  • GET /api/catalog/columns (real table schemas from sys.columns)
  • GET /api/jobs
  • GET /api/job-history
  • POST /api/jobs/run

SQL request body:

{
  "tenant": "default",
  "sql": "SELECT name FROM users",
  "timeout_ms": 5000
}

Auth accepts either:

Authorization: Bearer <token>
X-TinySQL-Auth: <token>

Run a registered job immediately:

{
  "tenant": "default",
  "name": "nightly_maintenance",
  "timeout_ms": 30000
}

Status responses include a health object:

{
  "ok": true,
  "storage_mode": "disk",
  "scheduler_running": true,
  "wal_active": false,
  "advanced_wal_active": false,
  "recovery": {
    "mode": "memory",
    "recovered_transactions": 0,
    "recovered_operations": 0,
    "truncated": false
  }
}