Skip to main content
Technical Enough

Data, where information lives

Chapter 4 of 7 in The Technology Stack · 18 min

Twenty minutes into a build session, the agent stops and prints a question: "Should I store saved items in a database, or keep them in a local file for now?" A file sounds simpler, so you answer: just a file. A few colleagues try the build over the following days, and then one messages you a screenshot with her saved list empty. You spend an evening tracing it and find two problems at once. Every save read the whole file, added one item, and wrote the whole file back, so when two testers saved close together, the second save wrote over the first, and this had been happening all week without a sign. And the file was stored on the hosting service's temporary disk, which the host wipes on every deploy, so your latest update erased whatever saves were left. Nothing crashed and no error appeared: the file kept whatever was written last, until the deploy deleted that too.

The agent's question was where your app's data should live. All data lives in some structure: your photos in files, your household budget in a spreadsheet, your bank balance in a database.

The database table that would have kept her list

Here is the same data in the other option the agent offered, a database table:

saved_items
id | user_email       | item                        | saved_at
1  | [email protected] | Sunrise Alarm Clock         | 2026-06-24 09:12:41
2  | [email protected]  | Folding Desk Lamp           | 2026-06-24 09:12:41
3  | [email protected] | Noise-Cancelling Headphones | 2026-06-25 14:03:09
4  | [email protected]  | Standing Desk Mat           | 2026-06-26 08:47:52

Each line is a record, also called a row: one saved item. Every record has the same columns: who, what, and when. Rows 1 and 2 have the same time, down to the second: Asha and Leo saved at the same moment. Both rows are still there because a database never rewrites everything it stores: each save is added as its own row, and one row does not overwrite another. A hosted database, one that a database company runs for you on its own machines, is separate from your app's machine, so a deploy that wipes the app's disk never touches the records. And you can ask the table questions the file could never answer: "which items did Asha save this week?" is a query, a question asked across every record at once.

The four forms data can live in

Nearly every piece of data in software sits in one of these places.

  • A file on disk. The usual place for drafts, exports, images, and configuration (the settings a program reads): data that is read often, written rarely, and changed by one person or one program at a time.
  • A spreadsheet. A file with rows and columns, plus an editing screen at no extra cost; Google Sheets and Airtable made a spreadsheet a reasonable place to keep a small app's data.
  • A database. A service built for records like the saved_items table: many users can write at once, each write becomes its own row, and you get answers by query. This is where the backend keeps everything it must not lose.
  • A data warehouse. A database set up for analysis across long stretches of history rather than for running an app; you will not need one for a long time.
The four forms data can live inTwo sorting questions sit above four tiles in a row, ascending in weight: who writes it, and what will you ask of it. The tiles are a file on disk, a spreadsheet, a database, and a data warehouse, each with a small glyph and a note on what the form is for. The database tile is highlighted with a spruce border and a DEFAULT eyebrow, because once data is shared between users or written at once, a database is the safe pick. The warehouse is labeled much later. Caption: for most builds with linked records, a hosted Postgres database is the usual default.Who writes it? · What will you ask of it?FILEread often,written rarelySPREADSHEETsmall, sharedlookupsDEFAULTDATABASEconcurrentreads & writesWAREHOUSEanalytics,much laterFor most builds with linked records, a hosted Postgres database is the usual default.

In the drawing, two questions sort the four forms, and the opening failure shows why the first one matters. Who writes it? If one person writes from one device, a file is enough. If two people write, or one person writes from two devices, you need a form that keeps each write separate: a spreadsheet at small scale, and a database beyond that. What will you ask of it? If you only ever open it and look, a file or a spreadsheet is enough; if you need answers across many records, you need a database. The drawing marks the database as the DEFAULT for most builds, because once users share data or write it at the same time, a database is the safe choice.

List what your app will actually store, then pick the smallest storage form that holds it; moving to a bigger form later is routine, well-documented work, not a rewrite.

When you decide on a database, approve the default

When you decide on a database, your agent proposes one, and it is almost always Postgres: a relational database, meaning one that stores data in tables like the one above, hosted by a database company so you never run the machine yourself. Articles will compare it with document databases, which store looser JSON records (the labeled-fields format from APIs, how systems talk to each other) that do not all need the same fields; you do not have to settle that debate. Do what you did in Languages and frameworks: approve the pick: approve the default and note it, for example "Postgres, the agent's pick, accepted for now."

Why not just take the database every time

A fair objection: the agent can set up hosted Postgres the moment you say yes, so why keep all four forms in mind? Because a database is a second service that has to keep running, and it brings extra work of its own:

  • Another dashboard, another secret. A hosted database comes with its own console (the database company's control screen), credentials to protect, and backups to look after.
  • You cannot open it like a file. In your first weeks of fixing problems, checking a spreadsheet takes two minutes, while working your way around a database console can take a whole evening.
  • Columns you commit to early. A database needs its columns defined up front, and changing them later is a deliberate step, while in a spreadsheet you can add a column whenever you find you need one.

Keeping all four forms in mind lets you take on each cost knowingly. The opening scene showed what "just a file" costs once several people write to it and the disk is temporary, and this list shows what a database costs for a tool only you use.

The two kinds of data in an AI app

Once your app uses a model, its data comes in two kinds.

What the model is given this turn. A turn is one message and its reply. Every request carries everything the model gets for that one answer: instructions, the user's question, snippets your app looked up in its stored records (the drawing below calls them retrieved snippets), and recent turns of the conversation. This bundle is called the prompt, or the context. Your backend puts it together fresh for each request and sends it on the round trip you traced in The journey of a request, and once the model answers, the bundle is thrown away. The context window is the most text one request can include.

What your app stores. Accounts, documents, preferences, and conversation history are ordinary records in the forms above. They are durable, meaning they last between sessions, and protecting them is your job.

IN THE PROMPT, THIS TURNSTORED BY YOUR PRODUCTinstructionsthe questionretrieved snippetsrecent turnsrebuilt for every request, then goneaccountsdocumentshistorydurable, queryable, yours to protectProducts feel like they remember because they store, then re-send.

The drawing shows the two kinds, with an arrow from the stored records back into the prompt: your app sends stored records again in the next prompt, which is how apps seem to remember you. The next section shows this with a real record.

Where an app's memory actually lives

Suppose you add a suggestion feature: a model proposes one item the user might want next. One afternoon Asha types "warm-light products only, please," and the app stores that line as a record:

preferences
user_email       | detail                   | noted_at
[email protected] | warm-light products only | 2026-06-25

On her next visit, your backend puts the stored row into the prompt, next to her two saves from the table above:

You suggest one item for the saved-items app.
About this user: warm-light products only.
Recent saves: Sunrise Alarm Clock, Noise-Cancelling Headphones.
User message: "any desk lamp for me?"

The model receives the bundle and returns a warm-light lamp, and then the bundle is thrown away; a model keeps nothing from one request to the next. When she tells you the app remembered her, both parts of how that works are printed above: the stored record, and the prompt that carried it.

When an app seems to remember you, the app stored the detail as a record and sent it again in the next prompt.

Apps you use every day work the same way. When ChatGPT shows "Memory updated," a record like Asha's row has just been written; ChatGPT's settings page lists every saved line, and later conversations start with those lines in the prompt. Give the model the facts it wasn't trained on covers what your build sends each turn, and what it costs as the bundle gets larger.

Try it now

This drill takes about fifteen minutes, and you spend nothing on either path.

No setup: Audit one AI app you already use, such as a chat assistant or a meeting notetaker. Write two lists. The first holds stored data, what it keeps across sessions: saved conversations, uploaded files, custom instructions, anything its settings page shows. The second holds context, what it uses only within one conversation: details you gave it ten messages ago that are missing when you start a new conversation. If it seems to remember something across sessions, find the stored record behind it. Add both lists to the idea file you started in Decode the technical questions that stop you, with one line on what your own idea would store and the smallest form that holds it.

With your tools: Open Claude Code, describe the app you are considering, and ask: "Split this app's data into two lists: what we store durably, and what we assemble into the model's prompt each request. Then name the smallest storage form that fits the stored list." Question any storage form heavier than the stored list needs, then copy both lists and the storage note into your idea file. Same move in Codex or Cursor: put the two-list question to the sidebar chat and push back on the storage pick. If your tools are not set up yet, the Setup Clinic gets you there in one sitting.

Chapter Summary

  • Data lives in one of four forms: a file on disk, a spreadsheet, a database, or a data warehouse.
  • A file is rewritten whole each time and keeps only what was written last, and an app host's disk can be wiped on every deploy; a database keeps every write as its own row and runs outside the app's machine, so shared data is safe from both problems.
  • A query is a question asked across every record at once, and it is the second thing a database gives you, after keeping every write separate.
  • List what your app would store and pick the smallest form that holds it, because moving to a bigger form later is routine work, not a rewrite.
  • When the answer is a database, agents propose hosted Postgres; approve the default and note it, the same move as your language and framework picks.
  • A database is also a second service that has to keep running, with its own console, credentials, and backups, so a tool only you use should not take one on.
  • An AI app holds two kinds of data: stored records that last between sessions, and the prompt, also called the context, assembled fresh for each request, capped by the context window, and discarded after the answer.
  • When an app seems to remember you, a stored record was sent again inside the next prompt; the model kept nothing.
  • Store less by default, because data you never keep cannot leak, cannot be subpoenaed, and cannot be sent to the wrong place.
  • Every one of these forms still needs a machine to run on, and Hosting, renting a computer on the internet covers renting that machine.

Sources

  • PostgreSQL documentation (postgresql.org), the relational database agents most often propose (last verified July 2026).
  • OpenAI Help Center, Memory FAQ, on ChatGPT's "Memory updated" notice and the saved-memory settings page (last verified July 2026).
  • Anthropic documentation on context windows and prompt construction (last verified July 2026).
  • EU General Data Protection Regulation, Article 5(1)(c), the data-minimisation principle (last verified August 2026).