A run402 example

Field Notes

All posts

Hello from a database

The page you are reading was assembled at build time out of a row in Postgres. Here is what that means and what it costs.

This post is not a file. There is no hello-from-a-database.md anywhere in the repository that produced this page. There is a row in a Postgres table with a slug, a title and a body, and a build step that turned it into HTML.

That distinction sounds academic until you try to change something. Content in files means a content change is a code change: edit, commit, push, wait for a pipeline. Content in a database means a content change is an UPDATE, and the only thing the pipeline still owes you is a rebuild.

What you give up

Static output. Every page here was written to disk once and is served as a plain file, which is why it loads the way it does. The cost of that speed is that a published post does not change until the next build. There is no revalidation window and no cache to bust, because there is no cache: there is a file, and the file changes when you rebuild.

If you need a page that reflects the database on every request, this is the wrong shape and you want a server-rendered route instead. What you get in exchange is a site with no runtime dependency on the database at all. The database can be down and every post still loads.

Back to all posts