Tagged “backend”

2 posts found.

Jul 10, 2026· 2 min read ·6 views

Idempotency keys, or how to make retries safe

The network failed after the charge but before the response — now what

Key takeaways
  • A timeout tells you nothing about whether the work happened.
  • Idempotency is a property of the endpoint, not of the client.
  • Store the key with the result, not just the key.

A client calls POST /payments . The charge succeeds. The response times out on the way back. The client has no idea whether it worked. If it retries, you might charge twice. If it…

Jul 9, 2026· 2 min read ·9 views

The N+1 query problem, and why your ORM hides it

One query for the list, then one more per row, forever

Key takeaways
  • Loop bodies that touch the database are the smell.
  • Log your SQL in development — the count is the tell.
  • Fix it by fetching related rows in one query, not by caching the symptom.

You fetch 50 posts. Then, for each one, you read its author. That is 1 + 50 = 51 queries where 2 would do. It looks harmless because each individual query is fast. The problem is t…