Optimizations Are Trades Made Within Constraints With No Free Lunch

Arpit Bhayani

Arpit Bhayani

Jun 30, 2026 • 1 min read


Never look at optimization in isolation. It only makes sense in the context of constraints. Every optimization is a trade. There is no free lunch.

Take indexing in a database. An index makes reads faster, but it does not come for free. Every write now has to update the index, too, so insert and update latency go up. Storage grows. You have traded write cost for read speed.

Concurrency control is another one. Optimistic locking gives you high throughput when conflicts are rare, but when they are not, you pay in retries and wasted work. Pessimistic locking protects you from that cost, but now every transaction locks entities even when no conflict would have happened.

You will never find an option with no downside. Hence, when you are trying to optimize on one axis, find an axis on which you can relax.

Optimization is just a negotiation game. :)

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses