Skip to content

Commit

Permalink
chore: explain async insert in docs (#969)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaflik authored Apr 11, 2023
1 parent b3c72d8 commit 60bcaa7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The client is tested against the currently [supported versions](https://github.c
* Connection pool
* Failover and load balancing
* [Bulk write support](examples/clickhouse_api/batch.go) (for `database/sql` [use](examples/std/batch.go) `begin->prepare->(in loop exec)->commit`)
* [AsyncInsert](benchmark/v2/write-async/main.go)
* [AsyncInsert](benchmark/v2/write-async/main.go) (more details in [Async insert](#async-insert) section)
* Named and numeric placeholders support
* LZ4/ZSTD compression support
* External data
Expand Down Expand Up @@ -268,6 +268,19 @@ Order is the highest abstraction to the lowest level implementation left to righ

Usage examples for [native API](examples/clickhouse_api/client_info.go) and [database/sql](examples/std/client_info.go) are provided.

## Async insert

[Asynchronous insert](https://clickhouse.com/docs/en/optimize/asynchronous-inserts#enabling-asynchronous-inserts) is supported via dedicated `InsertAsync` method. This allows to insert data with a non-blocking call.
Effectively, it controls a `async_insert` setting for the query.

### Using with batch API

Using native protocol, asynchronous insert does not support batching. It means, only inline query data is supported. Please see an example [here](examples/std/async.go).

HTTP protocol supports batching. It can be enabled by setting `async_insert` when using standard `Prepare` method.

For more details please see [asynchronous inserts](https://clickhouse.com/docs/en/optimize/asynchronous-inserts#enabling-asynchronous-inserts) documentation.

## Benchmark

| [V1 (READ)](benchmark/v1/read/main.go) | [V2 (READ) std](benchmark/v2/read/main.go) | [V2 (READ) clickhouse API](benchmark/v2/read-native/main.go) |
Expand Down

0 comments on commit 60bcaa7

Please sign in to comment.