Fixed-scope diagnostic · PostgreSQL
Performance diagnostic (PostgreSQL)
Your PostgreSQL database is slow, or a schema change on a busy table needs a plan, and you're not sure what to do next. I take one question we've agreed on, go through the evidence and give your team a plan, most important step first.
Suitable questions
Typical starting points are slow queries, locking and indexing, or a schema change you need to plan, such as:
- A screen or job is fast for some accounts and slow for others, and nobody can say why.
- Your team has execution plans but isn't sure which query or index change to test first.
- You have workload evidence, but it doesn't make clear where to start.
- A schema change is coming on a busy table, and you need to know which locks it takes, whether it rewrites the table and how to run it without stopping writes.
- A change is too big to run in place, so the plan is a second database or an Aurora blue/green deployment, and you want the cutover reviewed before anyone runs it.
I look at statistics and maintenance where they bear on the question we agreed. It isn't a full vacuum, bloat or instance audit. I confirm the scope before I start.
How it runs
- A free scope review call pins down the one question and what you need from the answer.
- You and I agree the environment, the evidence, how I get to it, the effort limit, the fee and the schedule.
- I review the evidence and ask for anything else I need.
- I write up what the evidence shows, what is still a hypothesis, and what to test first.
- I walk your team, or your agency's team, through the findings and the tests.
Fixed fee, agreed after a free scope review call.
The scope review is a free call. We pin down the one question you need answered and what you need from it, and I follow up with a written proposal.
The effort limit is the scope of work we agree up front. It doesn't grow unless we both agree to extend it.
What the investigation may examine
These are possible lines of investigation. I pick them for the question at hand; it isn't a checklist every engagement goes through. A sequential scan isn't automatically a defect, and I don't hand out generic parameter recipes.
| Area | Example focus |
|---|---|
| Query and plan behaviour | Query structure, estimated against actual rows where they can be collected safely, joins, filters, sorts, and the changes worth testing. |
| Workload evidence | The statement statistics you already have, the window that matters, and which queries to look at first. |
| Indexes and statistics | Whether the current definitions and what the planner shows support a change worth testing. |
| Schema changes | Which lock each step takes, whether it rewrites or scans the table, what your application sees while it runs, and the order of steps that keeps the blocking short. |
| Moving to a new database | What logical replication or a blue/green deployment carries and what it doesn't (DDL, sequences), how writes are stopped for the cutover, and the way back. |
| Operational context | Workload, concurrency and resources, where they bear on the question we agreed. |
What you receive
You get a written report and a technical handover. The report covers:
- The question and the scope of the investigation.
- The evidence I reviewed, where it came from and the conditions it was collected under.
- Findings, and the uncertainty that remains.
- Recommendations in priority order, with the reasons and the trade-offs that matter.
- A plan for validating them, and the questions still open.
- A technical handover.
Recommendations are proposals for your team to test, not changes ready to run in production.
Sample report: inconsistent query latency across tenant accounts
Why is the recent-orders query fast for some tenant accounts and slow for others, and what should the team test before changing anything?
- No index serves the account filter and the sort together
- Behaviour that changes after repeated executions points to plan caching
- No execution plans for slow accounts were supplied
Capture plans for a small, a median and a large account on a non-production copy.
Synthetic PostgreSQL scenario; no customer data or measured results.
Read the PostgreSQL sample →Evidence and safe collection
I start with what your team already has: the relevant schema and index definitions, redacted query examples, existing plans or statistics, the PostgreSQL version and platform, and when the problem shows up.
-
EXPLAIN ANALYZEruns the statement, so we agree in advance where and when any capture happens (PostgreSQL documentation). -
I don't assume
pg_stat_statementsis installed; turning it on can need a restart (documentation). You don't need it to get in touch. - I read queries and plans for the version you actually run.
- Plans, SQL and statistics can contain sensitive values, so we agree redaction and transfer first.
Not included
- Making production changes or implementing the recommendations.
- Unlimited troubleshooting or a review of every database you run.
- Emergency response, on-call cover or ongoing monitoring.
- Running a migration, upgrade or cutover for you, or owning replication, failover or high availability. I review the plan; your team runs it.
- Guaranteed root-cause identification, speed improvements or savings.
Anything beyond the question we agreed needs its own scope, agreed explicitly.
Working with MySQL, MariaDB or Aurora MySQL? See the Performance diagnostic (MySQL, MariaDB, Aurora MySQL).
Questions
What should I provide before you can scope the work?
A short description of the slow workflow or the change you're planning, when it happens, the PostgreSQL version and where it runs. Nothing sensitive is needed at this stage. We agree the evidence once the question is clear.
Do you need direct production access?
Not necessarily. For some questions, what your team already has is enough: schema and index definitions, redacted queries, existing plans or statistics. For others, a copy or a replica is more useful than production. We agree evidence and access for each engagement.
Can you review a schema change before we run it?
Yes, one change or one migration plan. I look at which locks each step takes, whether it rewrites the table, what your application will see while it runs, and how to try it on a copy first. Running it in production stays with your team.
What happens if the evidence is incomplete?
We agree the next collection step, or we change the scope. Otherwise the report says what I couldn't establish and what would settle it. I can't promise a definite answer whatever the inputs.
Will you implement the changes?
No. The diagnostic ends with findings, prioritised recommendations, a validation plan and a handover. Your team or your implementation partner makes and approves the changes.
Can an agency commission the diagnostic for its client?
Yes. You keep the client relationship and the implementation work. Before I start, you and I settle your client's approval, the access I get and how evidence is shared.
How are price and schedule agreed?
After a free scope review call I send you a written proposal with the scope, effort limit, fixed fee and schedule. I don't start until you've agreed to it.
Have a PostgreSQL performance question, or a schema change to plan?
Tell me about the workflow or the change, what you're seeing and what you need to find out. Please leave out credentials, customer data and raw logs.