How I Used LLMs to Help a Team Understand a Legacy Database in Hours

- 10 Apr, 2025
When I step into an organization as a fractional VP of Engineering, one of the first things I look for is where the technical bottlenecks are. Recently, that meant tackling a legacy Postgres database that was critical to the business — and completely undocumented.
The original devs were long gone. The team had questions. I had no time to try to sift through the database schema just to understand what was going on.
So I brought in some backup: a large language model.
The Problem: No Docs, No Context, Big Pressure
This wasn’t just an old database. It was a black box holding answers to customer behavior, revenue data, and key business logic.
I needed a fast, reliable way to understand how everything was connected — and make that knowledge accessible to the team.
Step 1: Dump the Schema
The first step was getting the structure out into the open. I used a simple pg_dump command to pull just the schema:
pg_dump --schema-only --no-owner my_database > schema_dump.sql
This stripped out the data and gave me a clean view of tables, columns, and relationships.
Step 2: Condense with an LLM
The raw schema was too bulky for direct use with an LLM, so I created a prompt that asked ChatGPT to generate a condensed, token-efficient version:
Prompt:
You are going to help me answer questions about database schemas. The first thing I want you to do is create a condensed version of this schema. The condensed version should provide enough information to an LLM to answer questions about the database. However, it should be optimized to use as few tokens as possible.
– INSERT THE OUTPUT SCHEMA FROM STEP 1 –
The result? A tight summary of all the important stuff — table names, key fields, relationships — ready for question-answering.
Step 3: Turn ChatGPT Into a Schema Assistant
With the condensed schema in hand, I created a project in ChatGPT and provided the following prompt as custom instructions.
Prompt:
You are going to help answer questions about this database. I am going to provide you with a condensed version of a Postgres schema. – INSERT CONDENSED SCHEMA –
Whenever your ask ChatGPT a question in a project it will add your custom instructions to the top of your question.
Now, when someone asks, “Where do we store customer preferences?” or “How does order tracking work?” I’ll ask ChatGPT to generate my a query, run the query and get the results.
The Outcome: Team Superpowers
This setup didn’t just help me onboard quickly — it gave I felt like it gave me DBA super powers.
No new tooling. No huge docs. Just smart use of LLMs to bridge the gap and keep momentum moving.
Bring This to Your Team
This is just one example of how I help teams move faster with less friction. If you’re dealing with legacy systems, gaps in documentation, or just want to explore how LLMs can boost your org’s velocity:
👉 Schedule a strategy session today.
If you want to see others ways I’ve leveraged LLMs check out how I built an entire LLM product and engineering “team” and launched an app in about 30 days
Let’s give your team some superpowers.
Stay Ahead in Product Management!
Ready to elevate your product management game? Join our community of passionate professionals and be the first to receive exclusive insights, tips, and strategies directly in your inbox. Subscribe now to our newsletter and ensure you're always in the loop with the latest product management trends and wisdom bombs!