A step-by-step performance comparison of five approaches to batch-updating database records in .NET using PostgreSQL. Starting from a naive Dapper loop (326ms for 1,000 records), progressing through EF Core with change tracking, a single-statement batched Dapper update using VALUES, the equivalent EF Core raw SQL version, and finally PostgreSQL's unnest() function. Benchmarks show unnest() is the fastest approach—completing 10,000 record updates in ~40ms versus 3 seconds for the naive loop—while EF Core adds overhead compared to raw Dapper for equivalent strategies.

13m watch time

Sort: