Run your first query
Create a table, insert rows, and query real PostgreSQL on Silos.
You're connected — now let's run real SQL. Because Silos runs a genuine PostgreSQL engine, everything in this page is ordinary Postgres. If you know Postgres, you already know Silos.
Create a table
From your psql session (silos connect my-app), create a table:
CREATE TABLE todos (
id SERIAL PRIMARY KEY,
title TEXT NOT NULL,
done BOOLEAN NOT NULL DEFAULT false,
created TIMESTAMPTZ NOT NULL DEFAULT now()
);Insert some rows
INSERT INTO todos (title) VALUES
('Create a Silos database'),
('Connect with psql'),
('Run my first query');Query the data
SELECT id, title, done FROM todos ORDER BY id; id | title | done
----+--------------------------+------
1 | Create a Silos database | f
2 | Connect with psql | f
3 | Run my first query | f
(3 rows)Use real Postgres features
This is standard PostgreSQL, so the full SQL surface is available — transactions and
MVCC, JSON/JSONB, CTEs, window functions, PL/pgSQL, triggers, and views. For
example, a transaction with a CTE:
BEGIN;
WITH updated AS (
UPDATE todos SET done = true WHERE id = 1 RETURNING *
)
SELECT title FROM updated;
COMMIT;Most pure-SQL and many C extensions work in the WASM runtime, but some heavyweight ones (such as TimescaleDB and Citus) are not available. Check PostgreSQL compatibility before relying on a specific extension.
Run SQL without psql
You don't have to use the terminal. The Console includes an in-browser SQL editor backed by PGLite, and the CLI can run a one-off statement:
silos sql my-app "SELECT count(*) FROM todos;"