← All projects

Back end

SQL benchmark database

Schema, views, window functions and indexes, with an in-browser SQL playground.

Done Sprint S10 · 5 points
In short, no jargon for non-developersRead the summaryClose
What it is
A database that stores speed measurements of the other projects, and that you query right in the page.
What it is for
To organise results so as to answer precise questions quickly: which program is fastest, on which files.
What it shows
Command of databases, and the habit of measuring before concluding: these measurements revealed a slowdown, fixed later.

Taught in L2 (databases)

Source code

How the pieces fit together

Diagram: Benchmark → Flat CSV (writes) ; Flat CSV → PostgreSQL (loaded in SQL) ; PostgreSQL → Views ; pgTAP → PostgreSQL (checks) ; PostgreSQL → SQLite copy (same schema, SQLite dialect). writes loaded in SQL checks same schema, SQLite dialect Benchmark Node, lib-c, topology Flat CSV one row per repetition PostgreSQL schema, constraints Views windows, regressions pgTAP tests in the image SQLite copy sql.js, on the page

Query the database in your browser

A SQLite copy of the database (same tables, same views) runs in your browser with sql.js: read anything, even break everything, the database reloads.

Examples:

Ctrl+Enter (⌘+Enter on Mac) to run. At most 200 rows are shown; a query is stopped after 5 s.

Tables and views
  • Shown once the database is loaded.

Tech stack

  • PostgreSQL
  • SQL
  • sql.js
  • pgTAP

Who does what

PostgreSQL
Stores the performance measurements (campaigns, meshes, files, timings), with constraints and a trigger.
SQL
The analyses: window-function views, log-log regression of the complexity, regression detection, an index justified by the query plan.
sql.js
SQLite compiled to WebAssembly: the same database can be queried in the browser, on the project page.
pgTAP
The database tests: schema, constraints, views and expected results, in CI.

Definition of Done

  • Code reviewed, diff by diff
  • Unit and integration tests green
  • Green CI on Linux, Windows and macOS when compiled
  • README, REVIEW.md and DECISIONS.md up to date
  • Texts in French and English
  • Demo deployed and tested on mobile