When should I switch to a covering index with INCLUDE to get an index-only scan?
Add INCLUDE only when the query is hot and EXPLAIN (ANALYZE, BUFFERS) shows heap access dominating, then tighten autovacuum until Heap Fetches: 0.
Just Ask
Ask me anything about software architecture, careers, PHP, Go and the craft of building software; I answer here, in the open, for everyone. (Page 3/10)
The questions here are compiled from what I have run into in the field and from what people have asked me; I write the answers. No record carries the name of whoever asked.
Add INCLUDE only when the query is hot and EXPLAIN (ANALYZE, BUFFERS) shows heap access dominating, then tighten autovacuum until Heap Fetches: 0.
Move to errgroup.WithContext with a request-level timeout on top and thread ctx into every HTTP and DB call; an ignored ctx means no cancellation at all.
Use chunkById() when there is real per-row work and never touch the cursor column; if you only update a column, switch to one set-based UPDATE.
A readonly withX returns a new instance: new self with named arguments is portable, and clone($this, [...]) fits PHP 8.5 when validation is simple.
Take an ownerless org-level problem, lay the solution out in a written tech strategy, and show impact through the teams you accelerate, not your commits.
Generate the ID as a W3C traceparent, carry it in an SQS message attribute rather than the body, and inject it with the OTel propagator on both sides.
Pin the user with a build-time ARG UID, use COPY --chown, and for named volumes chown only storage and bootstrap/cache in the entrypoint.
Go contract-first with openapi.yaml as the single source of truth; what ends drift isn't the direction you pick but a green contract test running in CI.
Build the partial index on WHERE status='pending', include the ORDER BY column, pair it with FOR UPDATE SKIP LOCKED, and pass 'pending' literally.
Cancellation propagates only if you pass r.Context() into every downstream call, leave no context.Background() in the chain, and use WithoutCancel.