> ## Documentation Index
> Fetch the complete documentation index at: https://basedash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ClickHouse

> Connect your ClickHouse database to Basedash

Connect your ClickHouse data warehouse to Basedash to analyze and visualize your enterprise data.

## Prerequisites

* A ClickHouse server or cloud instance
* User credentials with appropriate access
* Server host and port information
* SSL certificates (if using secure connection)

## Connection setup

1. Open the **Data** page and click **Add data source**
2. Select **ClickHouse**
3. Enter your connection details:
   * Database name
   * Username
   * Password
   * Host
   * Port: the HTTP interface port, usually 8443 with SSL (the default, and what ClickHouse Cloud uses) or 8123 without
   * SSL (turn on for HTTPS)
4. Click **Connect**. Basedash checks the connection, then opens the new data source and starts syncing its schema.

![The ClickHouse connection form in Basedash with database name, username, password, a ClickHouse Cloud host, and port 8443 filled in and SSL turned on](https://mintcdn.com/basedash/1uWWcBDZtjMM1cxJ/images/data-sources/warehouses/clickhouse/connection-form.webp?fit=max\&auto=format\&n=1uWWcBDZtjMM1cxJ\&q=85\&s=9fc656ffe8e0e83ef457387b3d421f02)

## Required permissions

Your ClickHouse user needs:

* `SELECT` privilege on required databases/tables
* `SHOW` privilege on databases
* `SHOW TABLES` privilege
* `SHOW COLUMNS` privilege

## Best practices

* Create a dedicated user for Basedash
* Enable SSL for secure connections
* Grant minimum required permissions
* Set appropriate query limits
* Regularly rotate credentials

## Performance optimization

* Use appropriate table engines
* Configure proper partitioning
* Set up materialized views
* Monitor query performance
* Use efficient indexing
* Enable query caching

## Troubleshooting

For what each connection error means and how to fix it, see [Connection settings](https://basedash.com/docs/data-sources/connection-settings.md#troubleshooting).

* Verify user permissions
* Check server connectivity
* Monitor resource usage
* Review server logs
* Validate query syntax
* Check SSL configuration

## Next steps: Add custom context

You can add custom context to help the AI better understand your data structure and business logic. Consider adding context at the database or schema level if you notice the AI struggling to locate or understand specific data.

### When to add context

* **Complex analytics data**: When the AI needs help understanding data structure and metrics
* **Business-specific metrics**: If calculated fields or KPIs need additional explanation
* **Unclear naming conventions**: When table or column names don't clearly indicate their purpose

For detailed guidance, see our [custom context documentation](https://basedash.com/docs/features/ai-context.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.