October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

The Database I Deleted: Migrating an Agentic RAG App to AWS Serverless, Part 3

Rebuilding an agentic RAG corpus exposed ID collisions and oversized chunks as its read path moved from a database to SQLite in S3. The implementation checks passed, but answer quality had not yet been measured.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • 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.

What should teams take from this migration?

The case supports a practical decision sequence rather than a blanket rule to delete databases:

  1. Classify each dataset. Separate immutable or rebuildable reference data from conversations, feedback, counters, and other mutable state.
  2. Measure the actual artifact. Check its size, load behavior, query needs, and compatibility with the runtime before replacing a service.
  3. Audit the build pipeline. Validate ID uniqueness, chunk boundaries, and embedding input limits when regenerating retrieval data.
  4. Test writes under contention. For reservations or caps, exercise conditional updates with concurrent requests and confirm the intended window and limit.
  5. 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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.