The 1990s database trick quietly running underneath every modern AI system.
Imagine a company with tens of millions of sales records spread across a dozen normalized tables. Every morning, analysts run the same reports: revenue by region, returns by product, margin by quarter. Each query forces the database to walk those tables, join them, aggregate the results, and hand back an answer. The data was always correct. It was just slow. And every time the question repeated, the database paid the full cost of answering it again.
The solution database engineers settled on in the 1990s has a name that is precise to the point of being almost too literal: the materialized view. A regular SQL view is a saved query definition. When you run it, the database executes the underlying query fresh against the base tables, so the answer is always current and the computation always happens at read time. A materialized view is different. The database executes the query once, stores the result physically on disk, and serves copies of that stored result to anyone who asks. The query no longer runs at read time. It ran the last time someone triggered a refresh.
The governing tradeoffs are deceptively simple, and the vocabulary that emerged to describe them is still in use today. Eager refresh updates the stored copy every time the underlying data changes, keeping it current at the cost of taxing every write. Lazy or deferred refresh updates the copy on a schedule or on demand, accepting that the stored answer might lag behind the truth. When Oracle shipped materialized views in Oracle8i in 1999, the feature included automatic query rewrite: the database optimizer would silently redirect a user's query to the precomputed summary table whenever it could, making the speedup invisible to the person asking. The question got an answer. The database got to rest.
The materialized view did not invent anything. It gave a formal name to a pattern that computing has returned to at every scale since the earliest days of the field. When a result is expensive to compute and likely to be needed again, store it. Trade the cheaper resource, which is space, for the scarcer one, which is speed. This is the space-time tradeoff, and it is one of the oldest organizing principles in computer science. It predates the database. It predates the operating system.
The clearest physical instance of this pattern is the CPU cache. Modern processors have access to billions of bytes of main memory, but RAM is slow. Retrieving a value from DRAM takes hundreds of processor cycles. So chip designers placed layers of smaller, faster memory between the processor and RAM: L1 cache, measured in kilobytes, returning results in a handful of cycles; L2 cache, somewhat larger and somewhat slower; L3, larger still. The processor checks each layer before going to the next. The deeper a value sits in the hierarchy, the longer the retrieval takes. The shallower, the faster. The entire structure exists for one reason: to avoid going all the way back to the slow truth.
What makes this pattern endure is not engineering habit. It is a permanent feature of how computing systems are built. Every system, at every scale, has a hierarchy: things that are cheap but slow on one end, things that are fast but limited or expensive on the other. Disk, network, RAM, cache, register. Corpus, index, embedding, vector, logit. As long as that hierarchy exists, there is an argument for keeping a precomputed copy of the answer close to where the question gets asked. The materialized view is not a trick. It is a response to a condition that does not go away.
The modern AI infrastructure stack, viewed through the lens of materialization, turns out to be something remarkably familiar. Embeddings are the clearest case. Generating an embedding, a dense numerical vector that encodes the meaning of a piece of text, requires running that text through a large neural model. The computation is not free. At corpus scale, it is expensive and slow. But once computed, the embedding is a derived artifact: it encodes what the text meant, at the moment it was processed, through the model that processed it. Engineers at companies building large-scale retrieval systems have started naming this directly. The embedding table, they argue, should be understood as a materialized view of the raw data, derived from a source, expensive to generate, and assumed correct by every system downstream of it.
Layered on top of embeddings are the index structures that make searching them fast. Exact nearest-neighbor search over millions of vectors means comparing a query against every entry in the corpus, which quickly becomes intractable. The practical answer has been approximate nearest-neighbor indexes: structures like HNSW, which builds a multi-layer navigable graph over the vector space, and IVF, which partitions the space into clusters and searches only the nearest few. Both are precomputed structures built over the embeddings, which are themselves precomputed over the text. Materialized views stacked on materialized views, each layer trading exactness and freshness for speed.
This becomes most explicit in retrieval-augmented generation, the architecture behind most production AI assistants. In a RAG system, a knowledge corpus is indexed offline: documents are divided into chunks, each chunk is embedded, the embeddings are stored in a vector database. When a user asks a question, the system retrieves the most relevant chunks from that index and passes them to a language model. The vector index is the materialized view of the corpus, and the chunking strategy is the view definition. Engineers building these systems in production have found that the hard part is rarely the model. It is the data pipeline: keeping the index current, handling deletions, managing schema changes. Engineers building RAG at AWS have framed it bluntly: the problem is not inference. It is data engineering with a neural wrapper.
The core architecture of modern AI retrieval systems sketched as a working diagram: source corpus flowing into a materialized embedding table, then into an approximate index, with the re-index path and staleness window marked as first-class engineering concerns. The materialization budget question is underlined at the bottom: how long can the copy lag? Daice Labs.
The materialization pattern reaches its most surprising expression inside transformer models themselves. Large language models generate text one token at a time. At each step, the model must attend to every token it has produced so far, a computation that requires deriving two quantities for each prior token: a key vector and a value vector. In a naive implementation, those vectors would be recomputed from scratch at every generation step. A sequence of a thousand tokens would require, at the final step, computing key and value vectors for all thousand prior positions. The work grows quadratically with length, and at modern sequence lengths, that cost becomes the dominant constraint on both speed and memory.
The KV cache, now standard in every production language model serving system, eliminates that redundancy. Once a key vector and a value vector have been computed for a token, they are stored, and subsequent generation steps read from the stored copies rather than recomputing them. The attention mechanism becomes not a recomputation but a lookup. Researchers at the University of California, Berkeley showed in a 2023 paper that existing serving systems wasted 60 to 80 percent of available GPU memory by reserving KV cache space in large fixed blocks. Their solution, PagedAttention, borrowed the virtual memory paging model from operating systems and applied it to cache management, reducing memory waste to under four percent and enabling two to four times higher throughput on the same hardware. The open-source framework vLLM implements it today.
Prefix caching takes the idea further. Many requests to a language model share a common opening: a fixed system prompt, a shared document passed as context, a standard set of examples. If those tokens have already been processed, their key and value vectors are already computed. Prefix caching detects the shared prefix, hashes it, and reuses the stored KV blocks across requests from different users without recomputation. Time to first token can fall by up to 80 percent. The economics have become explicit enough that cloud providers now price it directly: cached input tokens at Anthropic and OpenAI cost 50 to 90 percent less than uncached ones. The KV cache is a materialized view of attention computation over a fixed context, and the database community has been thinking carefully about exactly this tradeoff since 1999.
Every materialized view has a failure mode, and it is the same regardless of whether the view is a SQL summary table or a RAG vector index. The stored copy of the answer gradually diverges from the truth it was derived from. In a relational database, this divergence is at least legible: you can see when the view was last refreshed and count how many rows in the base tables have changed since then. In a vector index, the staleness is harder to perceive. Semantic similarity search has no concept of time. A document indexed 18 months ago scores just as well against a query as one indexed yesterday. The index does not know that the world moved on. Systems have shipped confident, relevant-sounding answers drawn from information that was simply no longer true, and no alarm fired.
Embedding drift makes this structurally worse. When the neural model that generated an index is upgraded, the new model produces vectors that occupy a geometrically different space. Vectors from the old model and vectors from the new one are not directly comparable. Mixing them in the same index produces retrieval results that are wrong in ways that are nearly impossible to detect from the outside: a query returns results, the results look plausible, and they are incorrect. The practical consequence is that a major model upgrade forces a complete rebuild of the index, re-embedding every document in the corpus from scratch. At scale, this is expensive and time-consuming, and it is not optional. Researchers have proposed learned mapping functions, sometimes called drift adapters, that translate between embedding spaces, recovering most retrieval accuracy without a full re-embedding. But the underlying problem does not disappear: the precomputed copy carries a version, and the version matters.
What the database tradition offers here is a conceptual frame that AI engineers are still assembling for themselves. Before choosing how often to refresh a view, the database administrator asks one question: how stale can this copy get before it causes a real problem? That number, not engineering preference or default configuration, drives the refresh strategy. A fraud-detection feature where five minutes of staleness causes wrong decisions demands near-real-time incremental maintenance. A documentation index may tolerate a nightly full rebuild. The materialized view is not just a performance artifact. It is a contract with the truth, and every contract comes with an expiration date.
Key references: Oracle8i Materialized Views Documentation, Oracle Corporation, 1999. PostgreSQL 9.3 Release Notes: Materialized Views, PostgreSQL Global Development Group, 2013. Kwon, W. et al., "Efficient Memory Management for Large Language Model Serving with PagedAttention," SOSP 2023, University of California, Berkeley. MatKV: KV Cache Compression using Autoencoders and KV Reuse in Large Language Models, arXiv:2512.06727, 2024. Vejendla, N. et al., Drift-Adapter: Efficient Domain Adaptation of Embedding Models Without Full Re-Embedding, arXiv:2509.23471, EMNLP 2025. RisingWave Labs, "Incremental Materialized Views: The Complete Guide," 2026. TigerData Engineering Blog, "Vector Databases Are the Wrong Abstraction," 2025. AWS Community Builders, "RAG Is a Data Engineering Problem Disguised as AI," 2025. Microsoft Research, GraphRAG: From Local to Global, 2024.
Daice Labs Inc.
Brookline, MA, USA
Roll the "daice"–exploration & programmable adaptation.