05-async-copy-batching

command
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 8 Imported by: 0

README

Asynchronous COPY batching

This example configures the generated CopyAccounts :copyfrom query for per-shard micro-batching. Two submissions target shard-0 and coalesce into one physical COPY; a third targets shard-1 and executes independently.

The one-hour batch timeout is intentional: the program demonstrates the full EnqueueCopyAccountsFlushCopyAccountsFuture.Await lifecycle without depending on a timer. FlushCopyAccounts forces every partial batch accepted before its barrier to execute across both physical shards.

Apply examples/sqlc/schema.sql to both databases, then set ASYNC_COPY_SHARD0_DSN and ASYNC_COPY_SHARD1_DSN before running:

go run ./examples/05-async-copy-batching

See Use asynchronous COPY batching for shutdown ordering, cancellation, partial-commit, and telemetry semantics.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL