06 / 08 · Service · Mayank Rawat

PostgreSQL schema design, query tuning and backend performance

Efficient schemas, query tuning, caching and benchmarks that hold up under real load. Available for freelance projects and full-time roles.

  • PostgreSQL
  • Prisma
  • Redis
  • Benchmarks
01

Overview

A good schema prevents more bugs than any amount of application code. I design PostgreSQL schemas whose constraints encode the business rules, and I measure before I optimise.

PAISAPAID's 139 tables use composite foreign keys for tenant safety and a trigger that keeps written commission lines unchangeable. NovaGate's benchmark measured 0.76 ms median overhead at 500 requests per second, and the write-up reports the slow tail and the defect behind it too.

02

What's included

  • Schema design, indexes and migrations with Prisma
  • Constraints and triggers that enforce business rules in the database
  • Exact money handling: integer minor units and append-only ledgers
  • Query tuning from slow-query logs and query plans
  • Caching, counters and rate limits in Redis
  • Load tests at fixed request rates, with warm-ups and repeated rounds
  • CI checks that stop edited migrations from reaching production
03

How I work

  1. 01

    Measure, then change

    Fixed-rate load tests with warm-ups and several rounds, compared against a direct baseline. NovaGate's benchmark took three attempts before the numbers could be trusted.

  2. 02

    Report the tail

    Medians look good on every chart. I report p99 as well, and what's behind it.

  3. 03

    Money is integers

    Amounts in minor units with BigInt and the rounding written out. Never floats.

04

Shipped proof

05

Questions

Our API is slow. Where do you start?
With measurements: timings per route, slow-query logs and a load test at a realistic rate. Slowness usually traces to a few queries or a missing index, and fixing those beats rewriting code.
Prisma or raw SQL?
Prisma for most of an app: typed queries and reviewed migrations. Raw SQL where a query needs it, behind code that checks what Prisma can't.
Do you work with MongoDB?
Yes, though I reach for PostgreSQL when the data has relations and rules that must always hold.

Other services

Need a hand with Databases & Performance?

Tell me what you're building and where you're stuck. I'll reply within a day.

Let's talk