PgBulkOps 0.1.0

dotnet add package PgBulkOps --version 0.1.0
                    
NuGet\Install-Package PgBulkOps -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PgBulkOps" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PgBulkOps" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PgBulkOps" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PgBulkOps --version 0.1.0
                    
#r "nuget: PgBulkOps, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PgBulkOps@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PgBulkOps&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=PgBulkOps&version=0.1.0
                    
Install as a Cake Tool
																					 PgBulkOps

PgBulkOps is a high-performance .NET library for PostgreSQL bulk operations. It provides ultra-fast bulk insert and bulk update methods using PostgreSQL’s native binary COPY protocol.

Built on top of Npgsql, PgBulkOps can handle millions of rows in just a few seconds.

✨ Features Bulk insert with PostgreSQL binary COPY Bulk update using COPY + temporary table + UPDATE ... FROM join Optional PascalCase β†’ snake_case column name conversion Progress callback with configurable batch size Fully async/await compatible πŸ“¦ Installation dotnet add package PgBulkOps

✨ Quick Start

Entity Definition

public class User { public long Id { get; set; } public string Name { get; set; } = default!; public string Email { get; set; } = default!; public int Age { get; set; } public bool IsActive { get; set; } public decimal Balance { get; set; } public DateTime CreatedAt { get; set; } public DateTime? UpdatedAt { get; set; } public string Country { get; set; } = default!; public DateTime? LastLogin { get; set; } }

Bulk Insert Example

using Npgsql; using PgBulkOps;

await using var conn = new NpgsqlConnection("Host=localhost;Database=test;Username=postgres;Password=secret");

var rnd = new Random(); var users = Enumerable.Range(1, 100_000) .Select(i β‡’ new User { Id = i, Name = $"User{i}", Email = $"user{i}@example.com", Age = rnd.Next(18, 70), IsActive = i % 2 == 0, Balance = (decimal)(rnd.NextDouble() * 10000), CreatedAt = DateTime.UtcNow, Country = i % 2 == 0 ? "TR" : "US", LastLogin = DateTime.UtcNow.AddMinutes(-rnd.Next(1, 10000)) });

await conn.BulkInsertAsync(users, "Users", opts β‡’ { opts.BatchSize = 50_000; opts.UseSnakeCase = true; opts.OnProgress = p β‡’ Console.WriteLine($"Inserted {p.Rows} rows..."); });

Bulk Update Example

// Update existing users foreach (var user in users) user.Name = user.Name + "_updated";

await conn.BulkUpdateAsync(users, "Users", "Id", opts β‡’ { opts.BatchSize = 50_000; opts.UseSnakeCase = true; opts.OnProgress = p β‡’ Console.WriteLine($"Updated {p.Rows} rows..."); });

⚑ Performance Typical throughput (depending on hardware, WAL, and indexes):

Bulk Insert β†’ 300k–400k rows/sec

Bulk Update β†’ 30k–80k rows/sec

In benchmarks, inserting 1,000,000 rows often completes in ~3 seconds.

⚠️ Notes PostgreSQL user must have INSERT/UPDATE privileges.

PascalCase properties map automatically to snake_case columns if UseSnakeCase = true.

For massive loads, consider disabling indexes and triggers temporarily.

πŸ“„ License MIT License – maintained by Onventus.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 201 10/5/2025