Most performance problems in production systems trace back to the schema, not the code. Good database design is the highest-leverage architecture decision you'll make.
Good database design is invisible when done right and expensive to fix when done wrong — schema migrations on a live system with real data are far harder than getting the model right early.
Start with a normalized schema (3NF) to avoid update anomalies and data duplication. Denormalize only for measured performance reasons — a read-heavy reporting table, a cache column for a frequently joined value — and document why.
Most applications — including most "we need NoSQL for scale" cases — are correctly served by PostgreSQL with proper indexing. Reach for NoSQL when the data model genuinely doesn't fit relational structure, not by default.
WHERE, JOIN, and ORDER BY clausesEXPLAIN ANALYZE to verify the planner is actually using your indexesAn index you never measured is a guess. Profile real query patterns before adding indexes, not after a slow query report from production.
For SaaS applications, the schema decision that matters most is tenancy isolation: shared tables with a
tenant_id column and composite indexes on (tenant_id, ...) are the right default for most
products — see the SaaS architecture guide for the full trade-off breakdown.
The database is the part of your system that's hardest to change after launch. Investing in schema design, indexing discipline, and a clear scaling path early pays off far more than optimizing application code later.
I'm Sandaruwan Jayasundara — Senior Software Engineer | Full Stack Developer. See how to build a SaaS application or get in touch about your data architecture.