Real Use Case

Use Case #15: Multi-Agent Schema Discovery

Using parallel agents to map an undocumented database schema across 200+ tables.

W

William Welsh

Author

Jan 6, 2026
8 min read

Use Case #15: Multi-Agent Schema Discovery

Inherited a legacy system. 200+ tables. Zero documentation. The previous developer left no notes.

Time to do archaeology.

The Challenge

Understanding a database schema is slow work. You query table structures, trace foreign keys, look at sample data, infer relationships. At 10 minutes per table, that's 33 hours of tedious work.

The Multi-Agent Approach

I asked Claude to parallelize the discovery. It spawned 5 specialized agents running concurrently:

Agent 1: Structure Mapper - Extracted all table definitions, columns, data types, constraints. Pure schema information.

Agent 2: Relationship Tracer - Found all foreign keys, both explicit (constraints) and implicit (columns ending in _id that matched other table primary keys).

Agent 3: Data Sampler - Pulled sample rows from each table to understand actual data patterns. Found that some "required" columns were always null.

Agent 4: Naming Analyst - Analyzed naming conventions to group related tables. Found prefixes: auth_ (authentication), inv_ (inventory), ord_ (orders), rpt_ (reporting).

Agent 5: Usage Detector - Checked row counts and modification timestamps to identify active vs. dead tables. 47 tables had zero rows. 23 hadn't been modified in 2 years.

The Synthesis

After parallel discovery, Claude merged the findings. Generated a complete ERD (in Mermaid syntax), table-by-table documentation with inferred purposes, relationship map showing all connections, recommendations for cleanup (those 47 empty tables), and naming inconsistencies to fix.

Time Comparison

ApproachTime
Manual discovery~33 hours
Single Claude session~6 hours
Multi-agent parallel~45 minutes

The Real Win

The parallel agents found things I would have missed. Agent 4 noticed that some inv_ tables didn't follow the pattern - they were actually inventory snapshots, not inventory data. That distinction mattered for the migration.


Database archaeology from a legacy Rails app, December 2025.

W

William Welsh

Building AI-powered systems and sharing what I learn along the way. Founder at Tech Integration Labs.

View Profile
Share this article:

Related Articles

View all →