AWS re:Invent 2025

A Query Went From 30 Seconds to 46 Milliseconds. Resizing Would Not Have Helped

Original speaker(s): AWS database specialist team, Amazon Web Services · Amazon Web Services

Verified sourceSession date not verifiedpresentation58:49EN2 min read

A database saturated by inefficient statements is indistinguishable from an undersized one, and resizing makes the symptom disappear at permanent cost while leaving the cause to reappear at the next scale.

The framing question this session opens with is better than the answer most teams give: can the problematic query be identified and fixed, and separately, is this the right instance type (4:16)?

The order matters. A database at 100 per cent utilisation because of poorly written statements (4:07) presents identically to a database that is genuinely undersized. The instinct is to resize, because resizing is a one-line change and query analysis is work. Resizing also makes the symptom disappear at higher permanent cost, and leaves the query in place to reappear at the next scale.

The number that shows why this matters

The example given is a query taking 30 seconds reduced to 46 milliseconds (10:19).

That is a factor of roughly six hundred, and it is the reason instance sizing is the wrong first move. No amount of additional hardware closes a six-hundred-fold gap — you would be paying continuously for capacity to execute something inefficiently, when the alternative was a change to one statement.

Improvements of that magnitude are also common rather than exceptional. They come from missing indexes, from a plan choosing a scan over a seek, from a join ordering that materialises far more rows than the result requires. Each is a specific, fixable thing, and each masquerades as a capacity problem.

Caching, and where it belongs

The discussion of caching frequently accessed data such as query result sets (15:36) is presented as a strategy, and its position in the sequence is what matters.

Caching a slow query makes it fast for repeated identical requests and does nothing for the rest. Applied before the query is understood, it hides a problem that will resurface as soon as access patterns shift. Applied after the query is efficient, it removes work that genuinely did not need repeating.

Same technique, opposite outcomes, decided entirely by what came first.

The operational number

The failover figure — up to 30 seconds recovery time (43:15) — is offered in the context of changing instance types without extended downtime.

It is worth extracting because it changes what kind of decision instance sizing is. If moving between types costs a maintenance window and a negotiation with the business, teams over-provision, because being wrong is expensive. If it costs half a minute, sizing becomes reversible, and reversible decisions can be made from evidence rather than from fear.

That, rather than any specific optimisation, is what makes the disciplined approach affordable: fix the query first, then size to what the fixed workload actually needs, knowing you can adjust again cheaply if you were wrong.

Key numbers

30s → 46ms
a single query after optimisation, a factor no instance resize would close 10:19
up to 30s
failover recovery time, which makes instance sizing a reversible decision 43:15

Talk chapters

Key takeaways

  1. 01

    The two questions in order: can the problematic statement be fixed, and separately is this the right instance type. 4:16

  2. 02

    A database saturated by poorly running statements looks identical to an undersized one, and resizing hides the cause at permanent cost. 4:07

  3. 03

    A single query moved from thirty seconds to forty-six milliseconds — a gap no additional hardware closes. 10:19

  4. 04

    Caching result sets before the query is understood hides a problem that returns when access patterns shift; afterwards it removes genuinely repeated work. 15:36

  5. 05

    Failover in up to thirty seconds makes instance sizing reversible, which is what allows sizing decisions to be made from evidence rather than fear. 43:15

Entities mentioned

Related talks

Escaping the Prompt-and-Pray Loop: Spec-Driven Development at re:Invent 2025
Escaping the Prompt-and-Pray Loop: Spec-Driven Development at re:Invent 2025

The practical counterpart to the argument made elsewhere this season that specification is what contains model entropy. Raval and Harris name the failure they are addressing precisely — a prompt-and-pray loop in which working code arrives with no record of what the model assumed, which requirements were fuzzy, what design was chosen or why, leaving nothing to review and nothing to iterate against when a defect surfaces months later. Their answer is three committed markdown artefacts: requirements written in a structured requirements syntax with acceptance criteria attached to each user story, a design document carrying technical decisions together with the reasoning behind them, and a task list whose entries cite the requirement numbers they satisfy. The traceability is the point — a reviewer questioning a decision in a pull request can follow it back through the task to the design to the requirement, all in the same repository. Notably they keep the human between each phase rather than after it, with the agent surfacing ambiguity as questions before proceeding.

presentation

The 10-15% Reality Check: Why AI Coding Gains Stay Small (re:Invent 2025)
The 10-15% Reality Check: Why AI Coding Gains Stay Small (re:Invent 2025)

Drawn from a year of engagements with more than a hundred companies, this is the most direct challenge in the season's programme to the assumption that faster code generation produces faster delivery. Mishra and Raja open with external evidence rather than their own: an industry study putting realised velocity gains in the ten to fifteen per cent range, and a controlled experiment in which developers using AI estimated themselves roughly a fifth more productive while measurement showed them a fifth slower. Their diagnosis is that both prevailing working styles fail for opposite reasons. Handing an ambiguous problem to an agent and awaiting a finished result produces a volume of code the developer must nonetheless sign for and cannot confidently review, so it stalls before production. The senior engineer's alternative — decomposing the work personally and inserting AI into narrow slots — keeps the intellectual load exactly where it was, and leaves the surrounding process untouched, so hours saved in editing are consumed by the meetings that process still requires.

presentation

What an Agent Actually Is: Marc Brooker on Agent Infrastructure (re:Invent 2025)
What an Agent Actually Is: Marc Brooker on Agent Infrastructure (re:Invent 2025)

Brooker builds the definition from the bottom up rather than asserting it, using a deliberately absurd arithmetic task to separate three categories: what a model computes reliably as a fixed function of its input, what merely needs to arrive in the system prompt, and what genuinely requires reaching into the world. Only the third category justifies a tool, and the distinction matters because most production disappointment comes from tools built for the first two. His working definition follows — a system given a goal that loops between inference and tool calls until it reaches one — with the observation that modern agents increasingly embed code in their definitions, not for expressiveness but because replacing inference steps with deterministic code improves reliability while lowering both latency and cost. The remainder covers what production actually demands around that loop: somewhere to run, memory that persists preferences, a gateway to internal and external tools, evaluation, and formal methods applied to policy.

presentation

Amazon's Answer to the Productivity Metrics Problem: Cost to Serve Software
Amazon's Answer to the Productivity Metrics Problem: Cost to Serve Software

The most concrete attempt this conference season to answer a question the agentic coding sessions mostly leave open: if commit counts and hours saved are the wrong measures, what replaces them? Otto's account is unusually specific about why the obvious alternative fails — summing the small time savings a platform team delivers produces figures exceeding a hundred per cent of a developer's time, and a minute returned is not code in production. Their replacement borrows from Amazon's retail supply chain, where cost to serve measures what it takes to place a package on a doorstep, and applies the same shape to software: total cost divided by units of delivery, with the unit chosen to fit the team. The supporting research is the more quotable finding — across tens of thousands of developers over five years, individual velocity reverts to the team's mean, making team velocity the strongest predictor of both individual output and perceived productivity, which is the empirical case against measuring individuals at all.

presentation

Two Banks Went Opposite Directions on Identity, and Both Worked
Two Banks Went Opposite Directions on Identity, and Both Worked

The framing statistic is organisational rather than technical: around eighty per cent of organisations expected to have platform engineering teams going into 2026, up from about forty-five per cent a couple of years earlier. The interesting part is the doubling. The problem described is teams solving the same problems separately, producing inconsistency and redundancy — dangerous not because of duplicated effort but because each independent solution has its own security properties, and the organisation's real posture is the weakest rather than the average. The most valuable content is that two financial services organisations went in diametrically opposite directions on workload identity and both are described as working, which implies the choice is determined by context rather than by a general answer. The honest note follows immediately: even with standardised patterns the result remains fragmented.

presentation

When Metadata Stops Describing the Access Path and Becomes It
When Metadata Stops Describing the Access Path and Becomes It

The line that explains this session comes from the customer in the last ten minutes: they are preparing for a world where metadata is how agent-based systems find the data they need and access it through the controls being built. That relocates a function — governance has spent two decades as compliance activity describing data that people locate by other means, and if agents navigate by the catalogue then the catalogue stops describing the access path and becomes it. An incomplete catalogue is a documentation problem when humans can ask a colleague; an agent has no such workaround. The most honest moment addresses the perennial failure that rules get written and ignored, with enforcement rather than publication as the argument. Generated descriptions and greyed-out classification suggestions divide the labour correctly, keeping a person accountable while removing the burden of finding candidates.

session