skip to content

play

write sql, run it right here, on a real postgres 18.6 compiled to webassembly. nothing leaves your machine.

everything.play
db =

a brand new database with nothing in it. the default when a block doesn't say db=.

query.sql · empty
loading the editor…
tables in emptyclick one to look inside

no tables yet. CREATE TABLE something.

output, from postgres 18.6
#1 · CREATE TABLE
#2 · INSERT 0 3
#3 · SELECT 3
idint4bodytext
1this is a real postgres
2it runs inside this tab
3nothing leaves your machine
(3 rows)

how this works, honestly

this is the real postgres 18.6 source, compiled to webassembly by the PGlite project (0.5.12), running in a web worker in this tab. the first run downloads about 6.0 MB, once. then it builds the dataset you picked from plain sql, which takes a second or so, and keeps a snapshot of it in memory.

every run starts from a fresh copy of that snapshot, unless “keep changes between runs” is on: then your tables and rows stay until you reset. the book's code blocks always start fresh, so they print exactly what the book shows. the book checks every one of them against this same engine.

it is postgres, but a postgres with a few things missing:

the glue is small and lives in public/sql and the datasets in datasets/, all plain sql.