A high-performance Go driver for ClickHouse offering both native and standard database/sql interfaces.
ClickHouse Go is the official Go language driver for connecting to ClickHouse databases. It provides both a high-performance native interface and a standard database/sql-compatible interface, enabling Go applications to efficiently read from and write to ClickHouse's analytical columnar database. The driver solves the problem of integrating Go applications with ClickHouse while offering optimized performance through direct protocol implementation.
Go developers building applications that need to interact with ClickHouse databases, particularly those working on data-intensive systems, analytics platforms, or real-time processing applications where database performance is critical.
Developers choose ClickHouse Go because it's the official, actively maintained driver that offers the best performance through native protocol optimization while maintaining full compatibility with Go's standard database interfaces. Its unique selling point is providing both maximum performance for new code and easy migration for existing database/sql-based applications.
Golang driver for ClickHouse
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages ClickHouse's native format and the low-level ch-go client for direct column encoding, resulting in faster read/write operations as shown in benchmarks where the native API outperforms database/sql.
Provides both a high-performance ClickHouse-specific API (clickhouse.Open) and a standard database/sql interface (clickhouse.OpenDB), allowing developers to choose based on performance needs or compatibility with existing tooling.
Supports ClickHouse-specific features like query parameters, settings, OpenTelemetry, execution events, and client info via context, enabling fine-grained control and integration as documented in the examples.
Includes connection pooling, failover, load balancing, bulk writes, async inserts, and multiple compression algorithms (LZ4/ZSTD/etc.), with support for both TCP and HTTP protocols including proxy and TLS.
The database/sql interface is explicitly slower than the native API, as admitted in the benchmark section, making it a suboptimal choice for performance-critical applications that rely on standard abstractions.
The README notes deprecated APIs like Debug/Debugf and AsyncInsert(), which are being phased out in favor of new methods (e.g., Logger, WithAsync()), potentially causing breaking changes for existing codebases.
Setup involves numerous options for protocols, compression, timeouts, pooling, and client info, which can be overwhelming for simple use cases, as evidenced by the lengthy configuration examples in the README.