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

# How to test queries on different ClickHouse versions without installing ClickHouse

> Use ClickHouse Fiddle to run a query on a chosen ClickHouse version in the browser, and learn what the compatibility setting and system.settings_changes can tell you.

To see how a query or a function behaves on a particular ClickHouse version, without installing anything, use [ClickHouse Fiddle](https://fiddle.clickhouse.com/). It is a public web page where you write SQL, choose a ClickHouse version, run the query and get a link to the result that you can share. The bug report form of the [ClickHouse repository](https://github.com/ClickHouse/ClickHouse/issues) asks for reproducers in this form.

## Write a self-contained example

Every run starts on an empty server, so put everything the query needs into one script: the `CREATE TABLE`, the `INSERT` and the `SELECT`.

```sql theme={null}
CREATE TABLE readings
(
    sensor_id UInt32,
    temperature Float32
)
ENGINE = MergeTree
ORDER BY sensor_id;

INSERT INTO readings VALUES (1, 20.5), (2, 23.25), (3, 19);

SELECT
    version(),
    max(temperature)
FROM readings;
```

Including `version()` in the result makes it obvious which version produced it. On the version this article was checked with, the script returns:

```text theme={null}
   ┌─version()────┬─max(temperature)─┐
1. │ 26.12.1.1315 │            23.25 │
   └──────────────┴──────────────────┘
```

Fiddle is a public service: do not paste confidential data, credentials or addresses of your own servers into it. It is meant for small self-contained examples, not for queries that depend on your own data or servers.

## Compare two versions

Run the same script twice with different versions selected. For example, the range of the `Date32` type was extended in ClickHouse 22.8 to start at the year 1900; before that it started at 1925 (see the [2022 changelog](https://clickhouse.com/docs/resources/changelogs/oss/2022.md)). This query shows the difference:

```sql theme={null}
SELECT toDate32('1912-06-15');
```

On 22.8 and every later version the result is the date you passed:

```text theme={null}
   ┌─toDate32('1912-06-15')─┐
1. │             1912-06-15 │
   └────────────────────────┘
```

A version older than 22.8 cannot represent this date and returns a different value.

## What the compatibility setting does and does not do

On a server that you already have, the [`compatibility`](https://clickhouse.com/docs/reference/settings/session-settings/compatibility#compatibility) setting makes the server use the default values of settings from an older version. It does not turn the server into that version: functions, data types and bug fixes stay those of the binary that is running.

```sql theme={null}
SELECT getSetting('async_insert') AS async_insert;
```

```text theme={null}
   ┌─async_insert─┐
1. │ true         │
   └──────────────┘
```

```sql theme={null}
SELECT getSetting('async_insert') AS async_insert
SETTINGS compatibility = '25.12';
```

```text theme={null}
   ┌─async_insert─┐
1. │ false        │
   └──────────────┘
```

The default of `async_insert` changed in 26.2, so `compatibility = '25.12'` brings the old default back. The `toDate32` query above, however, returns `1912-06-15` with any value of `compatibility`.

To learn which defaults changed in which version, without running anything on the old version, query [`system.settings_changes`](https://clickhouse.com/docs/reference/system-tables/settings_changes):

```sql theme={null}
SELECT
    version,
    change.name AS setting,
    change.previous_value AS previous_value,
    change.new_value AS new_value
FROM system.settings_changes
ARRAY JOIN changes AS change
WHERE type = 'Session'
    AND version = '26.2'
    AND setting IN ('async_insert', 'deduplicate_insert')
ORDER BY setting;
```

```text theme={null}
   ┌─version─┬─setting────────────┬─previous_value─────────────┬─new_value─┐
1. │ 26.2    │ async_insert       │ 0                          │ 1         │
2. │ 26.2    │ deduplicate_insert │ backward_compatible_choice │ enable    │
   └─────────┴────────────────────┴────────────────────────────┴───────────┘
```

## When you need a real server of that version

For anything that Fiddle cannot run, start the version you need in a container. The official Docker image has a tag for every release and for every monthly version, as described in [Install ClickHouse using Docker](https://clickhouse.com/docs/get-started/setup/self-managed/docker.md#versions). Before an upgrade, also read the changelog entries between your version and the target version; [Which ClickHouse version to use in production?](https://clickhouse.com/docs/resources/support-center/knowledge-base/setup-installation/production.md) explains how to test a new version against your own workload.
