SShortSingh.
Back to feed

EF Core's ExecuteUpdate Cuts 8,956 DB Queries to One for Bulk Updates

0
·1 views

A developer discovered that a nightly archiving job built with EF Core was fetching 8,956 complete database rows just to flip a single boolean field on each, a pattern common in load-modify-save workflows. Benchmarking on a 20,000-row SQLite table showed this approach issued 8,956 SQL commands, took 27.4 ms, and allocated 1.8 MB of memory. Replacing the foreach loop with EF Core's ExecuteUpdate method reduced the operation to a single SQL UPDATE statement, cutting execution time to 10.6 ms and memory use to 68 KB. However, ExecuteUpdate bypasses change tracking, meaning in-memory entities are not updated and domain events or concurrency checks tied to SaveChanges are skipped. The developer recommends using load-modify-save only for entities with business logic, while bulk maintenance tasks should use set-based SQL operations instead.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Build a Delete Confirmation Modal in React with RTK Query and TypeScript

A developer tutorial published on DEV Community demonstrates how to implement a delete-with-confirmation workflow in a React TypeScript application. The guide uses Redux Toolkit Query (RTK Query) to handle API mutations and automatic cache invalidation after a record is deleted. A confirmation modal is triggered when a user clicks the Delete button, storing the selected agency ID in local state before any API call is made. Upon confirmation, the frontend sends the agency ID to a backend DELETE endpoint, which returns a success message displayed via React Toastify. The tutorial covers the full flow from component state management to API service setup using createApi and fetchBaseQuery.

0
ProgrammingDEV Community ·

No Evidence OpenAI Has a Model Named Astra, Public Records Show

A review of OpenAI's publicly available model documentation through August 1, 2026 found no model named Astra, nor any launch timeline or roadmap entry for one. OpenAI's current documented model lineup centers on the GPT-5.6 family, which includes variants named Sol, Terra, and Luna. The name Astra is associated with unrelated projects elsewhere, most notably Google DeepMind's Project Astra, which has no connection to OpenAI. Experts caution that attaching an unverified model name to a well-known company can lend it false credibility. Decisions involving product planning, procurement, or technical integration should rely solely on OpenAI's official published documentation.

0
ProgrammingHacker News ·

Debate: Does the Industrial Revolution Offer a Valid Template for AI-Era Growth?

A new essay published in July 2026 questions whether the Industrial Revolution serves as a reliable precedent for predicting explosive economic growth today. The piece examines the historical parallels often drawn between past industrialization and current technological acceleration. The author appears to challenge assumptions that modern growth trajectories will mirror those of the 18th and 19th centuries. The article was shared on Hacker News, attracting early attention from the technology and economics community.

0
ProgrammingHacker News ·

Medieval Magic Tome Ars Notoria Promised Instant Knowledge Through Prayer

The Ars Notoria is a medieval grimoire that claimed to grant its users instant mastery of academic subjects through prayers, diagrams, and rituals. The text, which dates back to at least the 13th century, was believed to invoke divine or angelic assistance to accelerate learning. It was used by scholars and clerics who sought rapid proficiency in subjects like philosophy, rhetoric, and theology. The work draws a historical parallel to modern promises of AI-driven instant knowledge acquisition. The Public Domain Review essay explores how this ancient text reflects a longstanding human desire to bypass the slow process of traditional learning.

EF Core's ExecuteUpdate Cuts 8,956 DB Queries to One for Bulk Updates · ShortSingh