# Quick start
> Get kdb, make a database, create a table, add rows, query them and open the web console.
- Category: Getting started
- Keywords: install, build, first steps, getting started, hello world, kdb version, kdb sql, kdb shell, kdb serve, console, sample data, tutorial
- See also: [Install packages and the Claude skill](install-packages.md), [SQL basics](sql-basics.md), [Sample data](sample-data.md), [Databases and the data folder](databases.md), [CREATE TABLE](create-table.md), [INSERT](insert.md), [Web console](web-console.md), [kdb serve](cli-serve.md), [What's new](whats-new.md)
KDB is one program: `kdb` (`kdb.exe` on Windows), with three folders of plain files next to it: `web/` (the web console), `help/` (these pages) and `skill/` (the Claude skill). It keeps each **database** in a folder. You talk to it with **SQL** (the language of databases). This page takes about 10 minutes.
KDB is a general-purpose database: market and time-series data, sensor readings, logs and metrics, accounting, users and logins, app backends. A small example: a table of daily stock prices, three rows, and a query.
**Example: Your first table, rows and query**
```sql
CREATE TABLE ochl_day (
time TIMESTAMP, symbol SYMBOL,
open DOUBLE, high DOUBLE, low DOUBLE, close DOUBLE, volume DOUBLE
) TIMESERIES(time) PARTITION BY YEAR DEDUP KEY (symbol, time);
INSERT INTO ochl_day VALUES
('2026-09-09', 'CITY', 512, 512.4, 504, 504.6, 182390),
('2026-09-10', 'CITY', 504.6, 507, 500.7, 504.9, 183040),
('2026-09-10', 'COAST', 380.5, 382, 375.2, 376.1, 186200);
SELECT time, symbol, close FROM ochl_day WHERE symbol = 'CITY';
```
Result:
`CREATE TABLE ochl_day (`
```text
table 'ochl_day' created
```
`INSERT INTO ochl_day VALUES ('2026-09-09', 'CITY', 512, 512.4, 504, 504.6, 182390), ('2026-09-10', '`
```text
3 row(s) inserted
```
`SELECT time, symbol, close FROM ochl_day WHERE symbol = 'CITY'`
| time (TIMESTAMP) | symbol (SYMBOL) | close (DOUBLE) |
|---|---|---|
| 2026-09-09T00:00:00.000Z | CITY | 504.6 |
| 2026-09-10T00:00:00.000Z | CITY | 504.9 |
(2 rows)
## Get kdb
There are three ways. Pick one.
| Way | You run | Then |
|---|---|---|
| An install package | unpack `kdb--windows-x64.zip` (or the Linux `.tar.gz`) and run `install.ps1` (or `install.sh`) | `kdb` is on your PATH, with its `web`, `help` and `skill` folders |
| Docker | `docker run` with the image `kdb` (below) | the server runs on port 9900, the PostgreSQL port on 8832 |
| Build from the source | `cmake` (below) | the program is in `build\bin\kdb.exe` |
[Install packages](install-packages.md) explains the packages and the Docker image in full.
### Docker
Syntax:
```sql
docker run -d --name kdb -p 9900:9900 -p 8832:8832 -e KDB_TOKEN= -v :/data kdb
```
The image holds the program and its three folders. Make it once from the source folder with `docker build -t kdb -f docker/Dockerfile .`. The data stays in the volume, so a new container keeps it.
- **Notes:** the server does not start without `KDB_TOKEN`. Paste the token into the console's token box, or send it as `Authorization: Bearer `. Add `--restart unless-stopped --stop-timeout 60` so it comes back after a restart and stops cleanly. See [Docker](install-packages.md#docker).
```bash
docker run -d --name kdb --restart unless-stopped --stop-timeout 60 \
-p 9900:9900 -p 8832:8832 -e KDB_TOKEN=my-secret -v kdb-data:/data kdb
curl http://127.0.0.1:9900/health
```
Then open and go on at [Open the web console](#console): the console and the HTTP API do everything the `kdb sql` steps below do.
### Build from the source
Syntax:
```sql
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --target kdb
```
Build the program from the KDB source folder. You need CMake, Ninja and a C++17 compiler (on Windows: MSYS2 UCRT64). KDB needs no other libraries.
- **Returns:** the program `build\bin\kdb.exe` (Linux and macOS: `build/bin/kdb`).
- **Notes:** a `kdb` run from `build\bin` finds the console, the help and the skill in the source folder by itself (`web/console`, `docs/help/site`, `.claude/skills/kdb`). To copy it to another PC, copy `kdb.exe` together with the folders `web`, `help` and `skill`, or make a package. Without `web/` the HTTP API still works, but `http://127.0.0.1:9900/` says the console is not installed. See [where kdb finds them](install-packages.md#folders). [Chapter 1](../tutorial/01-install.md) explains every step.
```powershell
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build --target kdb
$env:Path = "$PWD\build\bin;" + $env:Path
```
Check that it works:
**Command line: Show the version**
```bash
kdb version
```
Output:
```text
kdb 0.2.0-dev (crc32c hardware: yes)
tls: OpenSSL 3.6.3 9 Jun 2026
Stored-format features this build reads (51):
views 0.2.0-dev (2026-09-10) CREATE VIEW: the "views" file
partition_format_2 0.2.0-dev (2026-09-11) table partition files in format 2 (one raw block per column)
block_stats 0.2.0-dev (2026-09-11) column stats section in partition files (count, min, max, sum per column)
runs 0.2.0-dev (2026-09-11) log record 'C': rows of a bulk upsert kept as columns
auto_meta 0.2.0-dev (2026-09-11) AUTO id counters in the manifest (auto.
)
json 0.2.0-dev (2026-09-11) JSON columns (type code 12)
bytes 0.2.0-dev (2026-09-11) BYTES columns (type code 13)
check 0.2.0-dev (2026-09-11) CHECK constraints (catalog format 2, part 'C')
indexes 0.2.0-dev (2026-09-11) CREATE INDEX, UNIQUE and FULLTEXT indexes (catalog part 'I')
routines 0.2.0-dev (2026-09-11) functions, procedures and triggers: the "routines" file
users 0.2.0-dev (2026-09-11) server users and roles (_system.users)
audit 0.2.0-dev (2026-09-12) SET AUDIT ON: catalog part 'A', log record 'P', the _audit_log table
table_grants 0.2.0-dev (2026-09-12) GRANT ... ON TABLE (_system.users.table_grants)
totp 0.2.0-dev (2026-09-12) two-factor logins (_system.users.totp)
trash 0.2.0-dev (2026-09-12) dropped tables kept as _dropped__ for UNDROP TABLE
database_settings 0.2.0-dev (2026-09-12) ALTER DATABASE ... SET READ ONLY (_system.database_settings)
dialects 0.2.0-dev (2026-09-12) ALTER DATABASE ... SET dialect (_system.database_dialects)
pg_catalog_parts 0.2.0-dev (2026-09-12) PostgreSQL column types, multi-column keys, foreign keys, expression and partial indexes (catalog parts 'T', 'K', 'F', 'X')
sequences 0.2.0-dev (2026-09-12) CREATE SEQUENCE: the "sequences" file and its log records
batched_log_sync 0.2.0-dev (2026-09-11) log segments in the batched format (header flag 1, 16-byte commit records): group commit and --sync-commits batch
dedup_change 0.2.0-dev (2026-09-12) ALTER TABLE ... DEDUP ENABLE / DISABLE: the DEDUP KEY of a table that already holds rows
plpgsql_triggers 0.2.0-dev (2026-09-12) PostgreSQL plpgsql trigger functions and FOR EACH ROW triggers in the "routines" file
cached_views 0.2.0-dev (2026-09-13) CREATE CACHED VIEW: which views are cached, and REFRESH ON COMMIT, in the "views" file
deferred_triggers 0.2.0-dev (2026-09-13) CREATE TRIGGER ... DEFERRED: job records in the log, and the "trigger_queue" and "q/" files of queued jobs
materialized_views 0.2.0-dev (2026-09-13) CREATE MATERIALIZED VIEW: catalog part 'M', REFRESH MATERIALIZED VIEW log records, mv_dirty. in the manifest
table_ttl 0.2.0-dev (2026-09-13) TTL n DAYS on a table: catalog part 'L'
read_only_procedures 0.2.0-dev (2026-09-24) CREATE PROCEDURE ... READ ONLY in the "routines" file
dedup_insert 0.2.0-dev (2026-09-24) WITH (dedup_insert = 'upsert') on a table: catalog part 'U'
decimal128 0.2.0-dev (2026-09-25) NUMERIC(p, s) columns with more than 18 digits: 128-bit DECIMAL (type code 14) in the catalog, partition files and log
dedup_generated_key 0.2.0-dev (2026-09-25) a stored generated column in a DEDUP KEY, like the minute of the time (an older build refuses such a catalog)
symbol_partitions 0.2.0-dev (2026-09-25) PARTITION BY