Run queries on Aiven for ClickHouse®
Run queries against an Aiven for ClickHouse® database using the query editor, the Play UI, or the ClickHouse® client.
Aiven for ClickHouse runs queries in distributed mode across the entire cluster. In
standard ClickHouse, queries such as CREATE, ALTER, RENAME, and DROP affect only
the server where they run unless you explicitly add the ON CLUSTER clause. In
Aiven for ClickHouse, these queries are automatically distributed across the cluster.
You do not need to include ON CLUSTER in your queries.
Aiven for ClickHouse limits concurrent queries and connections:
max_concurrent_queries:25to400max_concurrent_connections:1000to4000
See Aiven for ClickHouse® limits and limitations for details.
Query a database with a selected tool
Query editor
Aiven for ClickHouse® includes a web-based query editor. In Aiven Console, open your service and click Query editor in the sidebar.
When to use the query editor
Use the query editor to run queries directly from the console as the default user. Queries run with the permissions assigned to this user.
Examples of queries
Retrieve a list of current databases:
SHOW DATABASES
Count rows:
SELECT COUNT(*) FROM transactions.accounts
Create a role:
CREATE ROLE accountant
Play UI
ClickHouse provides a built-in web interface called the Play UI for running SQL queries.
When to use the Play UI
Use the Play UI when you need to:
- Run queries as a non-default user
- Work with large query results
Use the Play UI
- Log in to Aiven Console, choose the right project, and select your Aiven for ClickHouse service.
- In the Overview page of your service, find the Connection information section and select ClickHouse HTTPS & JDBC.
- Copy Service URI and go to
YOUR_SERVICE_URI/playfrom a web browser. - Set the name and the password of the user on whose behalf you want to run the queries.
- Enter the body of the query.
- Select Run.
The Play UI works only when your browser can reach ClickHouse directly. If you restrict access by IP or the service is in a VPC without public access, use the query editor in the console to run queries as the default user.