Quick summary

What database optimization services fix: the handful of slow queries behind most slow apps. Missing indexes, code that sends hundreds of small queries, slow security policies, too many connections and table bloat are the usual causes, and each has a known fix.

Whether you need one: if pages get slower as you add customers or data, and the slowest queries take most of the database's time, the database is the place to start. Check that before you pay for a bigger server.

What it costs: database firms such as Percona, Pythian and Datavail quote per engagement and publish no prices. Upwork puts SQL developers at $18 to $40 an hour, and a full-time US database administrator earns a median $104,620 a year.

What to check: that they measure before and after, ship every change as a migration in your repo, and start with read-only access and a tested backup.

Database Optimization Services at a Glance

Where to get itWhat it costsBest for
A developer who works in your productTheir usual rate or a flat monthly feeA SaaS app that is slow and still has features to ship
Freelance database specialist (Upwork)SQL developers about $18 to $40 an hour on UpworkOne clear job, such as a list of slow queries to fix
Database consulting firm (Percona, Pythian, Datavail)Quoted per engagement, no public pricesLarge databases, outages and round-the-clock support
Monitoring tool (pganalyze)From $149 a month for one database serverFinding slow queries yourself, before or after a fix
Bigger database server (Supabase compute)About $10 to $110 a month, Micro to LargeA database that is simply too small for its load
Full-time database administratorA median $104,620 a year in the USA company with many databases and years of work

Before you hire anyone, answer these three questions:

  • Question 1, "Is it really the database?" Slow pages can also come from large images, heavy JavaScript or a slow outside API. Find out where the time goes before you pay to fix the wrong layer.
  • Question 2, "Is it a few queries or the whole server?" A few slow queries need indexes and rewrites. A server at full capacity all day may need a bigger size as well.
  • Question 3, "Will the fix live in my code?" Indexes and query changes should be migrations in your repository, so the next developer can see them and they survive a rebuild.

Is your app getting slower?

A senior developer on subscription: $1,995 a month, as many requests as you like, each shipped within 2 business days, and your money back if the first 14 days don’t prove it.

Get started

In this article

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

This guide is for founders with a live SaaS app that has started to feel slow: dashboards that take seconds to load, searches that time out, a database bill that keeps climbing. It explains how to tell whether the database is the cause, what database optimization services actually fix, what the work costs and who to hire for it. Most of the examples use PostgreSQL, the most used database among developers in Stack Overflow's 2025 survey, and Supabase, which runs PostgreSQL for many young SaaS products. If the problem turns out to be the whole backend rather than the database, our guide to backend development services covers that work.

Why a Slow App Costs More Than It Seems

Speed shows up in revenue, not just in complaints. In a study commissioned by Google and run by Deloitte with the agency 55, covering 37 brand sites and more than 30 million mobile sessions in 2019, a 0.1 second improvement in four speed measures lifted retail conversion rates by 8.4% and travel conversion rates by 10.1%. Those were shopping and booking sites, not SaaS dashboards, but the pattern holds wherever people wait: slow screens get used less.

For a SaaS product there is a second cost. The pages that slow down first are usually the ones your best customers use most, because they have the most data. The account with ten thousand records hits the slow query long before the trial user with ten.

Is It the Database? How to Tell Before You Pay Anyone

Database problems have a recognisable pattern. These signs point at the database rather than the browser:

  • Pages get slower as you add customers, records or history, even though the code has not changed
  • The slow pages are the ones that list, filter, search or total many records
  • Big accounts complain and small accounts do not
  • You see timeouts or "too many connections" errors when traffic spikes
  • The database's CPU or memory sits near its limit while the rest of the app is quiet

Then measure. PostgreSQL ships an extension called pg_stat_statements that, in its documentation's words, tracks "planning and execution statistics of all SQL statements executed by a server". Sorting by total time shows which queries cost the most, adding up every time they run. On Supabase, the Query Performance report shows the same information in the dashboard, and the Performance Advisor flags common problems such as foreign key columns without an index, inefficient row level security policies and duplicate indexes.

If the slow part is the page itself, such as large images, heavy scripts or layout that jumps around, that is front-end speed work instead. Google's Core Web Vitals set the targets: the main content within 2.5 seconds and a response to a click within 200 milliseconds, for at least three in four visits.

What Database Optimization Services Actually Fix

Most slow databases have one or more of the same few problems. A provider should be able to tell you which of these they found, with numbers.

  • Missing or wrong indexes

    Without an index, PostgreSQL's documentation explains, the database "would have to scan the entire" table, row by row, to find matching records. An index lets it go straight to them. Indexes are not free, though: the docs note that each one "adds overhead to data manipulation operations", and that indexes "seldom or never used in queries should be removed". Good tuning adds the indexes your queries need and drops the ones they do not.

  • Code that sends hundreds of small queries (N+1)

    A page that lists 100 projects and then looks up each project's owner one at a time sends 101 queries. Loading the owners together takes 2. This is called the N+1 problem, and it is common in code written with an ORM such as Prisma or Active Record, or generated by AI tools. Rails, for example, has an includes method for loading related records together. The fix is in the app code, not the database settings.

  • Slow row level security policies

    Supabase apps often use row level security to keep each customer's data private. Written carelessly, a policy runs a function or a lookup for every row. Supabase's guide recommends indexing the columns policies use, wrapping functions such as auth.uid() in a select so the result is computed once, and adding the same filter to the query itself rather than relying on the policy to filter.

  • Too many connections

    Every database has a connection limit, and serverless functions can open connections faster than they close them. A connection pooler shares a small number of database connections among many clients. Supabase's docs point serverless and edge functions at its pooler in transaction mode.

  • Table bloat and maintenance

    In PostgreSQL, updating or deleting a row leaves the old version behind until VACUUM reclaims the space. Autovacuum does this automatically, but busy tables can fall behind, and long-running transactions can stop it from catching up. Bloated tables are bigger and slower to read.

  • A server that is too small

    Sometimes the queries are fine and the database simply needs more memory or CPU. That is the last thing to check, not the first, because a bigger server hides problems that come back as you grow.

Database Performance Tuning on Supabase and PostgreSQL

Supabase publishes before and after timings for its row level security advice, run on a table with 100,000 rows. They show how large the gains from small changes can be.

171 ms to under 0.1 msA policy checking auth.uid() = user_id, after indexing user_id (Test 1)Supabase
11,000 ms to 7 msA policy calling an is_admin() function with a table join, after wrapping it in a select (Test 2b)Supabase
171 ms to 9 msAdding the user_id filter to the query instead of relying on the policy (Test 3)Supabase
Over 100xImprovement seen on large tables from indexing columns used in policiesSupabase

Supabase also offers an Index Advisor extension: you pass it a query and it returns suggested create index statements. It is a good starting point, not a final answer. A person still has to check that each suggested index is used and worth the extra cost on writes.

PostgreSQL performance tuning: the usual order of work

  • Step 1, Turn on measurement. Make sure pg_stat_statements or your platform's query report is collecting data, and take a snapshot of the slowest queries by total time.
  • Step 2, Read the query plans. Run EXPLAIN on the worst queries to see whether they scan whole tables, sort in memory or loop over rows.
  • Step 3, Fix the biggest cost first. Usually an index, a rewritten query or an N+1 loop in the app code.
  • Step 4, Fix connections. Put serverless traffic through a pooler and check the app is not opening a new connection per request.
  • Step 5, Check maintenance. Look for bloated tables, autovacuum falling behind and transactions left open for hours.
  • Step 6, Size the server last. Only once the queries are efficient, decide whether the load needs a bigger compute size.
  • Step 7, Measure again. Compare the new snapshot with the first one, and keep watching the same numbers.

Bigger server or better queries?

Supabase bills compute by the hour. Its compute table lists these sizes and connection limits:

Compute sizeAbout per monthMemoryDirect connectionsPooler clients
Micro$101 GB60200
Small$152 GB90400
Medium$604 GB120600
Large$1108 GB, 2 dedicated vCPUs160800

Source: Supabase, Compute and Disk docs, checked November 24, 2026. Supabase's Pro plan itself starts at $25 a month.

Moving up a size or two costs tens of dollars a month, which is cheap next to a developer's time. So when the server is genuinely full, upgrade. But the stat cards above show why that rarely ends the problem: a query that scans every row will scan every row on a Large server too, and the account that grows ten times bigger will find it again.

What Database Optimization Services Cost

Few database providers publish prices. Here is what is public.

$18 to $40An hour, typical rate for SQL developers on UpworkUpwork
$73 to $184An hour, estimated US freelance or contract DBA rates, junior to seniorSecondTalent
$104,620Median yearly wage for US database administrators, May 2025US Bureau of Labor Statistics
$149A month for pganalyze's Production plan, one database serverpganalyze

Database consulting firms such as Percona, Pythian, Datavail and REVSYS sell performance tuning as part of consulting or support contracts and quote each engagement. The BLS puts database architects, who design larger systems, at a higher median of $139,500 a year.

By our math: a first round of tuning on a small SaaS database, measuring, fixing the worst five or six queries, adding a pooler and checking maintenance, is often two to three days of focused work. At 20 hours, that is $360 to $800 at Upwork's SQL developer range, or $1,460 to $3,680 at SecondTalent's US DBA estimates. The bigger cost is often what happens next: new features add new queries, so speed needs checking as the product grows, not once.

Who to Hire for Database Optimization

A database consulting firm

Firms such as Percona, Pythian and Datavail employ database specialists and often offer round-the-clock support. Pythian's performance consulting page describes the targets as unindexed queries, blocking locks, poor execution plans and misallocated compute. This suits large databases, many servers, strict uptime needs or an outage happening right now. For a small SaaS app with one database, it is often more than you need, and they will not change your app code where many of the problems live.

Best for: large or business-critical databases, and emergencies.

A freelance database specialist

Upwork and Fiverr list many fixed-price "fix my slow queries" offers. A freelancer suits one well-defined job: here is a list of slow queries, make them faster. The risk is that they tune the database without touching the app code that causes the problem, or add indexes that slow down writes. Ask for before and after numbers and for every change as a migration.

Best for: a clear list of slow queries and someone who can review the changes.

A developer who works in your product

Many database problems start in the app: an N+1 loop, a query built on every page load, a policy written in a hurry. A developer who knows your code can fix the database and the code that calls it in the same change, then keep an eye on speed as new features land. This can be a long-term contractor or a development subscription. If the app was built quickly with AI tools and has several problems at once, vibe coding cleanup covers the wider job, and a code audit gives you a ranked list first.

Best for: a live SaaS app that is slow and still has features to ship.

A full-time database administrator

A full-time DBA makes sense for a company with many databases, large data and years of work ahead. At a median $104,620 a year before benefits, it is rarely the first hire for a small SaaS. Our guide to hiring a software developer covers when to add people to the team.

Best for: larger companies where databases are a full-time job.

What to Check Before You Give Anyone Database Access

Your database holds your customers' data, so how the work is done matters as much as who does it.

  1. 1

    Step 1, Make and test a backup

    Check that backups are running and that you can restore one. Hosting providers run the servers, but AWS's shared responsibility model, for example, says customers are responsible for managing their data.

  2. 2

    Step 2, Start with read-only access

    Measuring and reading query plans needs no write access. Give a read-only role first, or a copy of the database without real customer details.

  3. 3

    Step 3, Agree the numbers up front

    Write down the slow pages and the current timings, so "faster" can be checked afterwards.

  4. 4

    Step 4, Ship changes as migrations

    Every index, policy and setting change should be a migration file in your repository, reviewed like code, so it can be undone and reapplied.

  5. 5

    Step 5, Try changes on staging first

    Some changes, such as building an index on a big table, can lock it or slow it while they run. Try them on a copy first and plan when to run them on production.

  6. 6

    Step 6, Remove access when the work is done

    Rotate any passwords or keys you shared and remove the role you created.

Which Route Fits You?

PickUpgrade the compute sizeWhenThe slowest queries are already efficient and the server is at its limit all day

Cheap and quick on Supabase or similar hosts. Check the queries first, or the problem returns.

PickA freelance database specialistWhenYou have a clear list of slow queries and someone to review the changes

The cheapest route for one job. Ask for before and after numbers and migrations.

PickA database consulting firmWhenThe database is large, business-critical or down right now

Deep expertise and round-the-clock support, quoted per engagement.

Best fitPickA development subscriptionWhenYour SaaS app is slow, the causes are partly in the code, and you still have features to ship

One developer who fixes the database and the code that calls it, then keeps working through your list.

How StackTie Fits

StackTie is a development subscription for founders who have a live SaaS product and more to build than people to build it. A slow app is a common first request: you tell us which pages are slow, and we measure, find the queries behind them, and fix the indexes, policies, connections and app code that cause them. You add requests in plain English to your own Trello board, and we work them one at a time in the order you set. Every request comes back within 2 business days as a pull request with a plain-English summary of what changed and why, including the timings before and after, so database changes live in your repository like the rest of your code. One senior developer, Michael, leads every build, and everything we build belongs to your company and lives in your own accounts. There is no contract, you can pause when the work is quiet, and there is a money-back guarantee if it is not a fit. We are not a database firm with round-the-clock on-call, we do not run compliance audits, and we are not a whole team working in parallel. If your database is large and business-critical, or down right now, a specialist firm is the better fit. The flat monthly price and what is included are on the homepage.