Azure Database for Postgres Flexible Server: The Settings Worth Tuning
Azure Flex's defaults are conservative. The Server parameters blade is where most of the meaningful tuning happens. Here are the parameters I always touch.
Notes for the problems that show up after launch: bad plans, awkward migrations, index debt, vacuum pressure, replica lag, and the small decisions that make PostgreSQL easier to operate.
Azure Flex's defaults are conservative. The Server parameters blade is where most of the meaningful tuning happens. Here are the parameters I always touch.
Postgres on Kubernetes is feasible now in a way it was not five years ago. The operators are mature, the storage is good enough, and the failure modes are tractable. Here is what to know.
N+1 is the most common ORM-induced performance bug. The query count tells the story; the application code makes it impossible to spot at review time.
Prepared statements skip the planning step on repeated execution. Sometimes that is a 5x speedup. Sometimes it is a 50x slowdown. Knowing the difference matters.
Wrapping a transaction around an external API call sounds careful and is actually one of the worst patterns in production database code.
Backups only matter if restore is rehearsed. The real work is choosing RPO/RTO, preserving WAL, testing restores, and knowing what data you can afford to lose.
Most application-side retry logic is wrong. It either retries everything (and corrupts data) or nothing (and surfaces transient failures to users). Here is the right framework.
A batch job that worked fine in dev can saturate production. The fixes are not exotic — chunk size, lock duration, retry budget — but most teams skip them.
Using a Postgres table as a job queue used to be a recipe for contention. SKIP LOCKED makes it tractable. Here is the pattern that actually scales.
Advisory locks are useful when the database cannot infer the thing you are protecting. They are also dangerous when session scope, pooling, and lock ordering are treated casually.
Arrays are a Postgres feature that can simplify code and a feature that can lock you into bad design. Here is the rule I use to decide when to reach for them.
JSONB is great for things that genuinely vary per row. It is wrong for things that are stable. Most teams use it for both, and pay for it in queries that should have been simple.