Skip to content

doc(go-client): add per config detail config reference page#6004

Draft
kavirajk wants to merge 4 commits intomainfrom
kavirajk/go-client-detail-config-reference
Draft

doc(go-client): add per config detail config reference page#6004
kavirajk wants to merge 4 commits intomainfrom
kavirajk/go-client-detail-config-reference

Conversation

@kavirajk
Copy link
Copy Markdown
Contributor

Summary

This config reference covers every single config/tweaks a user can make in clickhouse-go client along with

  1. What it is?
  2. What's the default value?
  3. What's the recommended value?
  4. What are the ways we can override these configs
  5. What are the symptoms if those are configured in-correctly

Checklist

This config reference covers every single config/tweaks a user can make
in clickhouse-go client along with
1. What it is?
2. What's the default value?
3. What's the recommended value?
4. What are the ways we can override these configs
5. What are the symptoms if those are configured in-correctly

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clickhouse-docs Ready Ready Preview, Comment Apr 10, 2026 2:58pm
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
clickhouse-docs-jp Ignored Ignored Apr 10, 2026 2:58pm
clickhouse-docs-ko Ignored Ignored Preview Apr 10, 2026 2:58pm
clickhouse-docs-ru Ignored Ignored Preview Apr 10, 2026 2:58pm
clickhouse-docs-zh Ignored Ignored Preview Apr 10, 2026 2:58pm

Request Review

Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
Copy link
Copy Markdown
Contributor

@peter-leonov-ch peter-leonov-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My Clause suggests:

  • Add a "Version Compatibility" section for version-specific features
  • Expand explanation of "per block" timeout behavior for ReadTimeout
  • Consider adding a visual diagram for HTTP two-layer pooling
  • Add memory calculation examples for buffer sizing

Copy link
Copy Markdown
Member

@mshustov mshustov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is 🔥

|-------|-----------|----------|
| **Connection** | `clickhouse.Options` struct or DSN string | All queries on the connection |
| **Query** | `clickhouse.Context()` with `WithXxx` functions | Single query execution |
| **Batch** | `PrepareBatch()` option functions | Single batch operation |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call out which one takes precedence?


| Option | Type | Default | DSN param | Description | Best practice | When misconfigured |
|--------|------|---------|-----------|-------------|---------------|-------------------|
| `Protocol` | `Protocol` (int) | `Native` | Scheme: `clickhouse://`=Native, `http://`=HTTP | Communication protocol: `Native` (0) for TCP, `HTTP` (1) for HTTP | Use Native for ~30% better performance. Use HTTP for proxy support, firewall traversal (port 80/443), or HTTP-only compression (`gzip`/`br`). See [TCP vs HTTP](/integrations/language-clients/go/configuration#tcp-vs-http). | HTTP scheme with Native port (9000): connection refused. Native blocked by firewall: timeouts. |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current structure works well for AI agents. @Blargian

Image

I’d like to know your recommendations for improving readability for both human and AI agents.
Probably, we should follow the same pattern that Core uses ? https://clickhouse.com/docs/operations/server-configuration-parameters/settings

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've read agents process markdown tables just as well. I find them more readable for humans too, but could just be a personal preference.

| `Auth.Username` | `string` | `"default"` | `username` or URL user portion | Username for ClickHouse authentication | Never use `default` in production. Create dedicated users with minimal permissions. | Wrong username: `"Code: 516. DB::Exception: Authentication failed"`. Empty string: silently uses `"default"`. |
| `Auth.Password` | `string` | `""` | `password` or URL password portion | Password for ClickHouse authentication | Use env vars or secret managers in production. URL-encode special characters in DSN. | Wrong password: `"Code: 516. DB::Exception: Authentication failed"`. Special chars not URL-encoded: parsing errors. |
| `Auth.Database` | `string` | `""` (server default) | `database` or URL path (`/mydb`) | Default database for the connection | Always specify explicitly. Use dedicated databases per application in production. | Non-existent: `"Code: 81. DB::Exception: Database xyz doesn't exist"`. Empty in multi-tenant setup: queries hit wrong database. |
| `GetJWT` | `func(ctx) (string, error)` | `nil` | — (programmatic only) | Callback returning JWT for ClickHouse Cloud auth. Overridable per query with `WithJWT(token)`. | Implement token caching/refresh -- called per connection/request. | Expired token: auth errors. Blocking callback: timeouts. JWT takes precedence over user/pass. Requires TLS -- without it, falls back to user/pass silently. |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the recently introduced settings, it would be beneficial to include a client version when it was first added


### Timeouts {#timeouts}

| Option | Type | Default | DSN param | Description | Best practice | When misconfigured |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ to this when misconfigured section

| Option | Type | Default | DSN param | Description | Best practice | When misconfigured |
|--------|------|---------|-----------|-------------|---------------|-------------------|
| `DialTimeout` | `time.Duration` | `30s` | `dial_timeout` | Max time to establish a new connection. Also controls pool acquisition wait when `MaxOpenConns` is reached. | 5-10s on LAN, 15-30s on WAN/cloud. Never below 1s. | Too short: `"clickhouse: acquire conn timeout"` during congestion. Too long (> 60s): app hangs during outages. |
| `ReadTimeout` | `time.Duration` | `5m` (300s) | `read_timeout` | Max time to wait for a server response per read call. Applied per block, not entire query. Context deadline takes precedence. | 10-30s for OLTP, 5-30m for OLAP/long queries. | Too short: `"i/o timeout"` or `"read: connection reset by peer"` mid-query; server continues executing. Too long: dead connections not detected. |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is for OLTP here?


### HTTP-specific {#http-specific}

These options only affect `Protocol: clickhouse.HTTP`. Silently ignored for Native.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be wrapped as a warning?

```go
Settings: clickhouse.Settings{
"max_execution_time": 60, // important -- errors if unknown
"my_custom_setting": clickhouse.CustomSetting{Value: "value"}, // custom -- ignored if unknown
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


## Quick reference tables {#quick-reference-tables}

### Connection pool sizing {#pool-sizing}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Connection pool sizing {#pool-sizing}
### Connection pool sizing recommendations {#pool-sizing}


**Cause:** Connection pool exhausted -- all `MaxOpenConns` connections are in use and none became available within `DialTimeout`.

**Fix:**
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should one take each step one-by-one or do it all at once?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants