Awesome ClickHouseGolang

ClickHouse/ch-go

⭐ 428 Go repository created 2021-11-14

The project "ch-go" is a low-level Go client and protocol implementation for ClickHouse, an open-source, high-performance columnar OLAP database management system designed for real-time analytics using SQL. This client is optimized for very fast data block streaming with minimal network, CPU, and memory overhead. It operates over TCP and is designed to handle single connections without pooling or automatic reconnects, making it suitable for scenarios where low-level control and efficiency are paramount. For users needing higher-level features like connection pooling and compatibility with the database/sql interface, the project recommends using the "clickhouse-go" client or the "chpool" package for pooling. The client supports streaming query results efficiently by setting result and callback fields, allowing processing of large datasets in blocks. It also supports automatic result inference and single result column name inference, simplifying data retrieval. Writing data to ClickHouse is facilitated through prepared data blocks that can be streamed in multiple blocks, with examples provided for inserting data into tables with various data types including DateTime64, Enum, LowCardinality strings, and arrays. Additionally, the client supports writing and reading ClickHouse dumps in the native binary format, which is highly efficient for server interactions and client operations. The project emphasizes a column-oriented design that operates directly with blocks of data, offering dramatic performance improvements over row-first designs and HTTP APIs, with up to 100x and 700x speed increases respectively. Key features include OpenTelemetry support for structured query execution telemetry, no use of reflection or interface{}, and use of Go generics for complex data types. The project provides detailed examples and benchmarks, making it a powerful tool for developers needing high-performance, low-level access to ClickHouse databases in Go environments.

https://github.com/ClickHouse/ch-go

benchmarksbinaryclickhousecolumn-oriented-designdata-block-streamingdata-insertiondrivergenericsgogo-clientgolanghigh-performancelow-level-clientnative-formatolap-databaseopentelemetryprotocolprotocol-implementationreal-time-analyticssqltcp-client

Also in Golang

ClickHouse/clickhouse-go

clickhouse-go is a Golang SQL database client providing a native and database/sql interface for efficient and feature-rich interaction with ClickHouse.

mailru/go-clickhouse

A Golang SQL database driver for Yandex ClickHouse using the official HTTP interface, supporting extensive ClickHouse features and integration with tracing tools.

uptrace/go-clickhouse

A high-performance Go client library for ClickHouse using its native protocol, supporting modern Go features and efficient database operations.

roistat/go-clickhouse

A Golang connector for Yandex ClickHouse enabling efficient querying, data insertion, and cluster management for large-scale data processing.

vahid-sohrabloo/chconn

chconn is a high-performance, low-level Go driver for ClickHouse that supports all ClickHouse data types, batch operations, TLS, and compression protocols, optimized for speed and efficiency.

chdb-io/chdb-go

chdb-go provides Go bindings and a CLI for chDB, an in-process SQL OLAP engine powered by ClickHouse, enabling SQL query execution and database management within Go applications.