Skip to content
Database Optimization & Backend Performance

Database optimization & backend performance for data-heavy apps

Slow pages, timeouts and rising server bills usually trace back to a handful of queries, missing indexes or work done at the wrong time. I find the real bottlenecks in MySQL and PostgreSQL applications and fix them with measurements before and after.

  • 4.9 from 76 client reviews
  • 8+ years shipping production software
  • Reply within a few hours

A good fit if you…

  • Pages or API endpoints that get slower as data grows
  • Database CPU or hosting costs climbing without clear cause
  • Reports, imports or exports that time out
  • Need a second opinion before adding more servers
What’s included

Database Optimization & Backend Performance deliverables

  • Database performance analysis
  • Complex SQL query optimization
  • MySQL optimization
  • PostgreSQL optimization
  • Database indexing
  • Slow query analysis
  • Backend performance optimization
  • Data-intensive application optimization
  • Caching strategies
  • API performance improvements

Performance problems are usually specific#

When an application gets slow, the instinct is to upgrade the server. That buys a few months at best, and rarely fixes the cause. In most data-heavy applications a small number of queries, often an N+1 loop, a missing composite index or a report scanning a whole table, account for most of the time spent. Find those and the application speeds up without new hardware, and stays fast as data keeps growing.

The hard part isn't knowing that indexes exist. It's finding which three queries out of thousands are hurting you, understanding why the database chose a bad plan, and changing things safely on a live system with real customers.

Signs your application has a performance problem#

  • Pages or API endpoints get slower every month as tables grow, even though the code hasn't changed.
  • Database CPU sits near its limit, and hosting costs keep rising.
  • Reports, imports and exports time out, or lock up the app while they run.
  • Users see occasional errors under load that nobody can reproduce locally.
  • Someone has suggested a bigger server or a different database, and you'd like evidence before spending.

What I optimise#

Slow queries#

Rewriting joins and subqueries, fixing N+1 patterns in the ORM (Eloquent and Prisma make them easy to write by accident), paginating large tables efficiently, and selecting only the columns that are needed.

Indexing#

Composite and partial indexes that match your real filters and sort orders, verified with the query plan. I also remove duplicate and unused indexes that slow down every write.

Schema and data design#

Denormalising where it genuinely helps, adding summary tables for dashboards and reports, and archiving old data so hot tables stay small.

Background processing#

Moving imports, exports, emails, PDFs and third-party calls out of the web request into queued jobs, so users get a fast response and heavy work runs on its own schedule with retries.

Caching#

Caching expensive, rarely-changing results in Redis, with clear invalidation rules, after the underlying query has been fixed.

Search and vector workloads#

Full-text search and vector search with PostgreSQL and pgvector, tuned for the balance of speed and accuracy your feature needs.

Measured, not guessed#

Every change is measured before and after on realistic data. I use slow-query logs, EXPLAIN ANALYZE, application traces and request timings, and I change one thing at a time so each improvement can be attributed. You get a short report of what was slow, why, what changed and the measured result, so the knowledge stays with your team rather than in my head.

Changing a live database safely#

Performance work happens on production systems with real customers. Index builds run without locking tables where the database supports it, migrations are split into safe steps, and every change has a rollback plan. Most optimisation work causes no customer-facing downtime at all.

Real performance work#

  • Violerts: moving synchronous processing onto Horizon-based background jobs let the platform expand from 3–4 to 12+ NYC municipal datasets while keeping the app responsive, alongside a 60%+ frontend performance improvement in the affected workflows.
  • Multi-carrier SIM activation: one-by-one activations replaced by queued CSV batches, with polling replaced by a live Server-Sent Events stream, while keeping three-tier wallet accounting exactly consistent.
  • Henceforward AI: vector search on PostgreSQL with pgvector to power retrieval for a RAG chatbot, keeping all data in one database.

Common causes I find again and again#

  • N+1 queries hidden inside loops or serializers, turning one page load into hundreds of queries.
  • Missing composite indexes for the exact filter and sort a list page uses.
  • Offset pagination on very large tables, which gets slower the further users page.
  • Counting everything for badges and dashboards on every request instead of maintaining counts.
  • Synchronous third-party calls in the request path, so one slow provider slows the whole app.
  • Long transactions and locks from batch jobs running during peak hours.

Keeping it fast after the fix#

Performance isn't a one-off. Data keeps growing, new features add new queries, and a fast page can quietly become slow again. So the work ends with guardrails:

  • Monitoring and alerts on slow queries, response times and database load, so regressions are caught in days rather than months.
  • Query-count checks in tests for the busiest pages, so an accidental N+1 fails the build instead of reaching production.
  • A short guide for your team on the patterns that caused trouble and how to avoid them.

When a bigger server really is the answer#

Sometimes the queries are already good and the workload has simply grown. Then the right move is more capacity: a larger database instance, read replicas for reporting, or a separate worker server for queues. The difference is that you'll make that decision with evidence, and you'll know exactly what the extra spend buys.

Performance work often goes hand in hand with legacy modernization or ongoing Laravel development, and sometimes needs infrastructure changes through cloud and DevOps. For data-heavy products specifically, see real estate & data platforms.

Working together#

Performance engagements usually start with a focused audit: access to monitoring or logs, a copy of the schema, and a list of the slowest pages or endpoints. You get findings ranked by impact and effort, then I implement the fixes you approve. It can run as a fixed-scope project or as part of a retainer.

Is your application slowing down? Book a free call and describe the symptoms. I'll tell you where I'd look first.

How it works

How we’ll work together

  1. 01

    Measure

    Slow-query logs, APM traces and real request timings show where time actually goes.

  2. 02

    Diagnose

    Query plans, indexes, N+1 patterns and locking are analysed for the worst offenders.

  3. 03

    Fix

    Targeted changes, including rewritten queries, indexes, caching and background jobs, each tested in isolation.

  4. 04

    Verify

    Before-and-after numbers for every change, plus monitoring so regressions are caught early.

Client feedback

What clients say

“Aqib is the best freelancer have worked with on Upwork. Efficient, has a wide skill-set, gets the job done efficiently and pays attention to detail. T…”

Carl-Peter lehmann

Founder, Henceforward

Jul 2026
Verified Upwork Client, Multiple Projects
“Extremely knowledgeable and hard-working. I would recommend Aqib to anyone wanting high quality and efficient development”
Ahmed Al-Hassany profile photo

Ahmed Al-Hassany

Managing Director & Founder, SafetySpace

Apr 2024
Verified Upwork Client, Client TestimonialClient Group: Ahmed
“Very professional developer, he helping to build really difficult project in time, and for reasonable price. Work with him not first time and really h…”
Eduard Y profile photo

Eduard Y

Founder, Planuojam

Jun 2026
Verified Upwork Client, Multiple ProjectsClient Group: Eduard
Planuojam - Strapi ArchitectureView original review →
FAQ

Database Optimization & Backend Performance: frequently asked questions

How do you find what's slowing the database down?

I start with evidence: slow-query logs, query plans (EXPLAIN ANALYZE), application traces and table statistics. That usually points to a few queries responsible for most of the load.

Will adding indexes fix it?

Sometimes. The right index can turn seconds into milliseconds, but every index also slows writes and uses storage. I add indexes that match real query patterns and remove ones nothing uses.

Do we need a bigger server?

Often not. Query and application fixes are usually cheaper than extra hardware and last longer. If scaling is genuinely needed, you'll get a clear recommendation with the reasoning and expected cost.

Do you work with both MySQL and PostgreSQL?

Yes, both, in production applications built with Laravel, Node.js and PHP.

Can this be done without downtime?

In most cases, yes. Index builds, migrations and query changes can be rolled out online and in stages, with a rollback plan for each.

What do we get at the end?

A short report listing what was slow, why, what changed and the measured result, plus monitoring and alerts so the same problems are caught early next time.

Should we add caching?

Caching helps for expensive results that change rarely, but it adds complexity and stale-data bugs if invalidation isn't designed carefully. I fix the underlying query first and cache only where it still pays off.