B JA Actbe·Practitioner post·

Hard-to-read DB schemas make AI development cost 1.9x

「読みにくいDB」はAI開発のコストを1.9倍にする――Claude Codeで検証したDB設計の影響

B · Useful, limited Actbe backend engineer runs a clean controlled comparison with hidden acceptance tests and lists its own limits; a useful small experiment, but five runs per condition on one task with one model.

Summary based on the full text·Original: about 6 minutes to read

In short

A Zenn post (23 October 2026) by Kitano, a backend developer at Actbe. He built one e-commerce database twice with identical logic and data: once with conventional names, comments, enums, datetime types and foreign keys, once with abbreviations, magic numbers, string dates, no comments and no relations. Claude Code then implemented the same sales query five times on each. The obscured schema cost about 1.9 times as much and produced one wrong answer. The finding is that what makes a schema easy for an agent is what has always made it easy for people.

Key numbers

  • 1.9xcost and output tokens for the obscured schema versus the readable one ($0.41 vs $0.21 per run)
  • 109 s vs 60 saverage time to finish the same task, obscured versus readable schema
  • 26.2 vs 18.8average agent turns per run, obscured versus readable
  • 4/5 vs 5/5runs passing the hidden acceptance test, obscured versus readable
  • 11.8 vs 5.0average Bash calls per run (mostly probing the live database), obscured versus readable

As reported by the source.

Read the original on zenn.dev

Japanese·Web page·opens zenn.dev

What it reports

  • Seven contrasts: naming (orders vs ord), column comments, value meaning ('cancelled' enum vs sts = 9), type (datetime vs char(14)), foreign keys, soft delete (deleted_at vs dflg = 'Y'), and price columns (unit_price_excluding_tax vs prc_a).
  • Task: top 10 products by sales for a given month, excluding cancelled and deleted orders, with traps such as large cancelled orders, orders at the exact month boundary and changed unit prices.
  • Averages over five runs: cost $0.21 vs $0.41; turns 18.8 vs 26.2; output tokens 7,050 vs 13,215; cache-read tokens 191,526 vs 409,169; time 60 s vs 109 s; correct 5/5 vs 4/5.
  • File reads were similar (8.6 vs 7.0); Bash calls, mostly inspecting the live database, rose from 5.0 to 11.8, and searches from 2.2 to 4.4.
  • The one failure: the agent treated the date strings as UTC and converted Japan-time month boundaries, which nothing in the obscured schema contradicted. The readable schema's comment said "order time (JST)".
  • When meaning is missing, the agent fills gaps with plausible assumptions, producing confident errors as well as higher cost.

How they got it

Laravel 13, MySQL 8.4 and PHP 8.4 in Docker; Claude Code run non-interactively with the model fixed to claude-sonnet-5-5. Source and database reset before each run; correctness judged by acceptance tests hidden from the agent; cost is Claude Code's own estimate.

Limits

  • Five runs per condition, no statistical test; the cheapest obscured run ($0.26) overlaps the most expensive readable run ($0.27).
  • The obscured schema was built deliberately and does not represent real legacy databases; naming and comments vary together.
  • One aggregation task, one model, estimated costs.

Why it matters for companies

Agent cost and error rates depend on the quality of the systems agents work against, not only on the model. Legacy schemas with cryptic names and no documented relations will make agent work slower, pricier and more error-prone. Adding column comments and foreign keys is cheap compared with paying the difference on every task, and it helps human developers too.

Key passages in translation

Japanese original

AIにとって読みやすいDBは、人間にとって読みやすいDBとほとんど同じでした。

English translation

A database that is easy for AI to read turned out to be almost the same as one that is easy for people to read.

Japanese original

読みにくい設計では、遅く高くなるだけでなく、もっともらしい誤りが出ます。

English translation

With a hard-to-read design, work gets slower and more expensive, and plausible-looking errors appear as well.

Japanese original

各条件5回で、検定もしていません。

English translation

Five runs per condition, and no statistical test.

Summary based on the full text. Read the original for the full argument and data.Read the original on zenn.dev

Tags

Same week

All of Week 43