How to check your ClickHouse version
Whether you're troubleshooting, upgrading, or simply auditing your systems, knowing your ClickHouse version is crucial. There are significant differences between versions, including breaking changes and noticeable performance differences for certain types of queries. In this post, we'll explore three methods to check the ClickHouse version tailored for developers in SaaS companies operating ClickHouse in production or exploring introducing it in their stack.
If you are looking for a serverless alternative to ClickHouse, where you get the benefits of ClickHouse’s speed without the overhead of managing additional infrastructure, check out Propel.
What is ClickHouse?
ClickHouse is a fast open-source columnar database. It is designed to perform exceptionally well with large-scale analytical queries. It is capable of processing hundreds of millions to more than a billion rows and gigabytes of data per second. Its columnar storage allows running fast analytical queries against large datasets, making it a good choice for use cases that require sub-second query latencies.
However, running production-grade ClickHouse clusters does come with its complexities. It requires teams to design sharding, clustering, partitioning, and backup strategies that need to be fine-tuned to maintain performance as the data and query volumes scale.
How to check the ClickHouse version with SQL
For database administrators and developers, SQL is the go-to language for database interaction. To check your ClickHouse version via SQL, you can use a simple query:
This command returns the version of the ClickHouse server you're currently connected to. It's straightforward, fast, and can be executed from any SQL client connected to your ClickHouse database.
You can also use the <span class="code-exp">system.build_options</span> table, which gives you not only the version but also the description and build information.
How to check the ClickHouse version using the HTTP endpoint
ClickHouse also provides an HTTP interface, which can be particularly useful for remote checks or automated scripts. To check the ClickHouse version using this method, you can send a GET request to the HTTP endpoint with the <span class="code-exp">version()</span> function. In this example, replace the "<span class="ce">user</span>" with your username and "<span class="ce">password</span>" with your password.
This command will return the version of ClickHouse running on the server. It's an effective way to integrate version checks into your CI/CD pipeline or monitoring systems.
You can also use the HTTP interface to get the ClickHouse version even if you don’t have access to the server. By sending a wrong query and incorrect credentials to the standard HTTP endpoint, you can find the version at the end of the response. The “Authentication Failed” error will give you the ClickHouse version of any server, even if you don’t have a valid username or password. The version in the example below is “22.214.171.124608 “.
How to check the version using the Prometheus endpoint
For organizations using Prometheus for monitoring, ClickHouse provides a Prometheus endpoint. You can query this endpoint to retrieve various metrics, including the ClickHouse version.
To check the ClickHouse version using Prometheus, you can query the relevant metric. This metric includes the version.
NOTE: This method only works when you run your own ClickHouse, not in ClickHouse Cloud.
Understanding how to check the ClickHouse version using SQL, HTTP, and Prometheus endpoints is essential for its operation. These methods provide flexibility and efficiency, particularly for teams responsible for operating ClickHouse deployments in production.
Reminder: If you are looking for a serverless alternative to ClickHouse, where you get the benefits of ClickHouse’s speed without the overhead of managing additional infrastructure, check out Propel.