# Create a database

**Target length:** 10 minutes  
**Kernel on camera:** 2.74.26 (same CREATE DATABASE verbs as 2.74.3)  
**Audience:** Someone who expects `CREATE DATABASE` and needs the store this kernel actually has.

`testdb`, `veloce`, and `postgres` share `testdb.bin`. Startup still writes `catalog.json` with `sys.tenants` and `testdb`. `INSERT` / `GET` / `MINSERT` / `MGET` take the word `TESTDB`. **2.74.3** also runs `CREATE DATABASE name` — that is a second DiskStore at `data/dbs/<name>/`, not PostgreSQL `pg_database`. Named stores are not WAL-shipped. analog ≠ native. certifiedClaim stays false. Film 09-multi-db.md for isolation and 11-clone-copy.md for clone.

On port 2143, a line the parser does not implement is echoed back as `OK sql …`. That echo is not a commit. Say that on camera before you type anything that looks like general SQL.

## On-screen beats

1. Data directory after first start: `catalog.json`, and the testdb journal the process creates on first write.
2. `SHOW TABLES` → `sys.tenants testdb`. `SHOW DATABASES` → testdb builtin, cluster true.
3. `INSERT` / `GET` / `COUNT` on `TESTDB` in the terminal, port 2143.
4. `CREATE DATABASE pm`, `USE pm`, insert, `USE testdb`, `GET` STATUS 4.
5. Control Center Databases pane + Overview: testdb row count and LSN move after the insert. Refresh.
6. Optional: `psql` to **15432**, `-d testdb` vs `-d pm`.

## GUI vs CLI

| Show in the GUI | Show in the terminal |
| --- | --- |
| Databases pane: List / Create / Clone / Drop | `CREATE DATABASE`, `USE`, `SHOW DATABASES`, `veloce db list` |
| Overview metrics: testdb rows, LSN, Refresh after the insert | Every `INSERT`, `GET`, `COUNT`, `SHOW TABLES` |
| SQL / builder posts to live `POST /api/v1/sql` | `veloce sql --database pm "COUNT TESTDB"` |

## Spoken script

“People sit down and type `CREATE DATABASE app`. Until 2.74.3 that line echoed. Now it creates another testdb.bin under data/dbs/app. It is not a PostgreSQL catalog. testdb, veloce, and postgres still share the cluster store. I will insert into testdb, then create pm, write a key there, switch back, and show testdb does not have that key.”

Show `catalog.json` in the data directory. Read the `tables` array.

“Two names: `sys.tenants` and `testdb`. The engine rewrites this file when the process starts. It is the catalog `SHOW TABLES` prints. Extra databases live in `data/databases.json` and `data/dbs/`.”

```text
SHOW TABLES
SHOW VERSION
SHOW DATABASES
```

“Reply: `sys.tenants testdb`. `VELOCE 2.74.3`. JSON listing testdb builtin cluster true.”

“Inserts are key and value on TESTDB. The value on a single `INSERT` is the rest of the line, so it may contain spaces. Keys are one token.”

```text
INSERT TESTDB cust-1001 Ada Lovelace
```

“Reply: `OK 1`.”

```text
GET TESTDB cust-1001
```

“Reply: `OK Ada Lovelace`. A missing key is `STATUS 4`.”

```text
GET TESTDB cust-missing
COUNT TESTDB
SELECT COUNT(*) FROM TESTDB
```

“Both COUNT lines return `COUNT` and a number after that insert. `SELECT COUNT(*) FROM TESTDB` is the one SELECT this port runs as a count. A different SELECT now runs through the query builder path — film 10-query-builder.md. If the line is not implemented, treat an `OK sql …` reply as an echo and stop.”

```text
MINSERT TESTDB cust-1002 Grace cust-1003 Linus
MGET TESTDB cust-1001 cust-1002 cust-1003
FLUSH TESTDB
```

Refresh Control Center Overview.

“Row count and LSN moved. Same TESTDB on 2143 and 1583.”

“Now a second store. I am not cloning testdb.bin. I am creating an empty pm.”

```text
CREATE DATABASE pm
USE pm
INSERT TESTDB job.1 leak
GET TESTDB job.1
USE testdb
GET TESTDB job.1
GET DB pm job.1
DROP DATABASE pm
```

“Replies: `OK database pm`, `OK 1`, `OK leak`, `STATUS 4`, `OK leak`, `OK database pm dropped`. USE is per TCP session.”

**pgwire.** `psql -h 127.0.0.1 -p 15432 -U veloce -d testdb` hits testdb.bin. After CREATE DATABASE, `-d pm` hits the named store. CRM `postgresql://veloce@127.0.0.1:15432/veloce` still hits testdb.bin. Do not point a production CRM at an empty named store.

Close.

“You created data by inserting into TESTDB. You created a second DiskStore with CREATE DATABASE. Neither step is PostgreSQL TEMPLATE. Clone is a file copy — that is video 11.”

## Exact commands

```text
SHOW TABLES
SHOW VERSION
SHOW DATABASES
INSERT TESTDB cust-1001 Ada Lovelace
GET TESTDB cust-1001
GET TESTDB cust-missing
COUNT TESTDB
SELECT COUNT(*) FROM TESTDB
MINSERT TESTDB cust-1002 Grace cust-1003 Linus
MGET TESTDB cust-1001 cust-1002 cust-1003
FLUSH TESTDB
CREATE DATABASE pm
USE pm
INSERT TESTDB job.1 leak
USE testdb
GET TESTDB job.1
GET DB pm job.1
DROP DATABASE pm
```

Replies to expect: `sys.tenants testdb`, `VELOCE 2.74.3`, `OK 1`, `OK Ada Lovelace`, `STATUS 4`, `COUNT N`, `OK 2`, `OK testdb flushed`, `OK database pm`, `OK leak`, `STATUS 4`, `OK database pm dropped`.

`RESET TESTDB` → `OK testdb reset`. Destructive. Do not run it on a live CRM store.

## Do not say

- That CREATE DATABASE is PostgreSQL `pg_database` or TEMPLATE.
- That named databases replicate with testdb HA.
- That leads.tuce.app moved off the `veloce` alias.
- That the sidecar replaces Postgres, or that a CRM should cut over to an empty named store.
- `psql` against 2143.
- A second engine, a headless server, or a Community build.
- Benchmark numbers. This video is a count of a few rows.
