Do you need a database service for a small, read-only dataset that can be regenerated? In Dmitriy Trunov’s agentic RAG application, rebuilding the corpus made the answer clearer: its 88 KB of project and library data became a SQLite/FTS5 file in S3, loaded by Lambda, while mutable conversations, feedback, and spend records moved to DynamoDB. The rebuild also uncovered retrieval-data defects. But whether the migration preserved answer quality remained unmeasured because two end-to-end quality gates had not run.
Why replace a database with a generated artifact?
In the preceding installment, Trunov describes a relational database holding 278 projects and a few thousand associated library rows—88 KB in total. The data was rebuilt from scratch and read-only during queries. For that workload, he replaced the database read path with a generated projects.sqlite artifact containing tables, the corpus, and SQLite FTS5 search. A pipeline published the file to S3, and Lambda loaded it into /tmp. Mutable conversations, feedback, and spend tracking went to DynamoDB instead. Read the preceding installment.
As an Amazon Associate I earn from qualifying purchases.
The useful distinction is not “SQL versus serverless.” It is whether a dataset must remain continuously available for writes and transactions, or whether it can be generated ahead of time and read as an artifact. A generated file can remove the need to keep a database service running for a small, static read path, but it also makes artifact generation, publication, loading, and freshness part of the application’s operating model.
Recommended Free Tools
When this pattern fits
- The read-only dataset is small enough for the application’s loading and runtime constraints.
- There is a reliable process to regenerate and publish it when source data changes.
- Queries can be served from the artifact’s supported indexes and search features.
- Mutable state is separated into a storage system designed for those writes.
What still needs deciding
Compare the idle cost floor and any cold-start or resume delay, query requirements such as full-text relevance, runtime and service limits, and the operational cost of splitting generated data from mutable state. Trunov’s account is a case study, not a universal AWS benchmark or a current pricing guide.
#1 Best Overall
What did regenerating the corpus uncover?
Trunov reports two defects exposed while rebuilding the retrieval corpus: identifier collisions and oversized chunks. These are not merely migration mechanics. Both can affect which source material is available to retrieval and embedding stages.
Repeated headings caused composed-ID collisions
The earlier identifier format combined repository, file path, and section as {repo}::{file_path}::{section}. When a file repeated a heading, distinct chunks could receive the same composed ID. Trunov counted 303 colliding IDs among 24,775 chunks. In this application, reciprocal-rank fusion deduplicated on that ID, so one member of a colliding pair could be shadowed rather than reliably surfacing. He says adding a per-file ordinal to the hash addressed this collision class.
A chunk exceeded the embedding input cap
The largest chunk before correction measured 119,786 bytes. Trunov estimated it at roughly 30,000 tokens, well above the 8,192-token Titan Text Embeddings input cap stated in the article. Splitting at paragraph boundaries, with a hard fallback for long tables and code blocks, reduced the reported maximum to 7,998 bytes. The rebuilt corpus contained 25,482 chunks. These counts and measurements are the author’s reported results, not independently validated benchmarks.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Regeneration can act as a data audit because it forces identifiers, boundaries, and assumptions in the corpus pipeline to be applied again. It does not automatically prove that the resulting chunks or ranking are better; those require their own checks.
Rank #3
How did the migration handle mutable spend state?
The spend cap could not be treated like the read-only corpus: concurrent requests needed to reserve capacity without exceeding the configured limit. Trunov reports porting the reservation to a DynamoDB conditional update that adds a reservation only when the existing total leaves enough headroom. The item key includes the UTC date, making the limit daily rather than a lifetime cap and avoiding a separate reset job.
In a reported test, 40 concurrent requests competed for capacity for five reservations, and exactly five were granted. That is a result for this implementation and test, not a blanket guarantee for every DynamoDB-backed reservation design. Applications should verify their own conditional-write logic, keying, failure handling, and capacity semantics.
Rank #4
Did the migration preserve answer quality?
That remained unknown in Trunov’s account. Two user-facing quality gates had not produced results:
Free tools Windows power users keep installed
One-click scans. No signup required.
- Tool routing: a question-by-question comparison against the OpenAI baseline had not run because model access was needed.
- Retrieval quality: hit rate and mean reciprocal rank had not been remeasured after replacing MiniLM/minsearch with Titan, S3 Vectors, and SQLite FTS5; the comparison depended on a generated ground-truth set.
Trunov separately reports narrower implementation checks: DynamoDB behavior was tested, SQL behavior was ported against a real 279-project artifact, and keyword retrieval was exercised over the rebuilt 25,482-chunk corpus. Those checks help establish that components work; they do not establish that the application routes tools or retrieves evidence as well as before. Without the two quality gates, claiming that answer quality survived the migration would go beyond the evidence.
Best Value
What should teams take from this migration?
The case supports a practical decision sequence rather than a blanket rule to delete databases:
- Classify each dataset. Separate immutable or rebuildable reference data from conversations, feedback, counters, and other mutable state.
- Measure the actual artifact. Check its size, load behavior, query needs, and compatibility with the runtime before replacing a service.
- Audit the build pipeline. Validate ID uniqueness, chunk boundaries, and embedding input limits when regenerating retrieval data.
- Test writes under contention. For reservations or caps, exercise conditional updates with concurrent requests and confirm the intended window and limit.
- Keep implementation tests distinct from quality tests. Run routing comparisons and retrieval metrics against a baseline before saying user-facing behavior was preserved.
As Trunov puts it, “Price the floor, not the feature.” In this case, the important architectural question was whether a small regenerated read-only dataset justified the cost and operational footprint of a continuously running database—not whether a database is inherently wrong for RAG applications.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




