---
title: NOT_IMPLEMENTED ClickHouse error
meta:
  description: Learn how to fix the NOT_IMPLEMENTED error in ClickHouse and Tinybird. Understand what causes it and see examples of how to resolve it
---

# NOT_IMPLEMENTED ClickHouse error

{% callout %}
This error usually means you're trying to use a feature or operation that isn't implemented in ClickHouse. This can happen when using features from other database systems or newer ClickHouse features in older versions.
{% /callout %}

The `NOT_IMPLEMENTED` error in ClickHouse (and Tinybird) happens when you try to use a feature, function, or operation that isn't implemented in ClickHouse or isn't available in your version. This commonly occurs when using features from other database systems or trying to use newer ClickHouse features in older versions.

## What causes this error

You'll typically see it when:

* Using features from other database systems (MySQL, PostgreSQL, etc.)
* Using newer ClickHouse features in older versions
* Using unsupported SQL operations
* Using client-specific features that aren't implemented
* Using deprecated or removed functionality

## Example errors

```sql {% title="Fails: MySQL-specific feature" %}
SELECT * FROM events FOR UPDATE
```

```sql {% title="Fails: PostgreSQL-specific feature" %}
SELECT * FROM events OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY
```

```sql {% title="Fails: unsupported operation" %}
UPDATE events SET event_type = 'click' WHERE user_id = 123
```

{% callout type="caution" %}
ClickHouse has no general-purpose UPDATE or DELETE. Only lightweight updates/deletes are available on MergeTree tables with `allow_experimental_lightweight_delete=1` or `allow_experimental_lightweight_update=1`.
{% /callout %}

```sql {% title="Fails: newer ClickHouse feature" %}
SELECT * FROM events USING SAMPLE 0.1
```

## How to fix it

### Use ClickHouse-compatible syntax

Replace unsupported features with ClickHouse equivalents:

```sql {% title="Fix: use ClickHouse pagination" %}
SELECT * FROM events LIMIT 5 OFFSET 10
```

### Use supported operations

Replace unsupported operations with supported alternatives:

```sql {% title="Fix: use INSERT for updates" %}
INSERT INTO events_new SELECT * FROM events WHERE user_id != 123
INSERT INTO events_new (user_id, event_type) VALUES (123, 'click')
```

### Check ClickHouse version

Verify feature support in your ClickHouse version:

```sql {% title="Check ClickHouse version" %}
SELECT version()
```

### Use alternative approaches

Find alternative ways to achieve the same result:

```sql {% title="Fix: use alternative approach" %}
SELECT * FROM events SAMPLE 0.1
```

## Common patterns and solutions

### Pagination

ClickHouse pagination syntax:

```sql {% title="Correct pagination" %}
SELECT * FROM events ORDER BY timestamp DESC LIMIT 10 OFFSET 20
```

### Data modification

ClickHouse doesn't support UPDATE/DELETE like other databases:

```sql {% title="Alternative to UPDATE" %}
-- Use INSERT with deduplication
INSERT INTO events_new SELECT * FROM events WHERE user_id != 123
INSERT INTO events_new (user_id, event_type) VALUES (123, 'click')
```

### Using MergeTree engines for "updates"

```sql {% title="ReplacingMergeTree for updates" %}
CREATE TABLE events_replacing (
    user_id UInt32,
    event_type String,
    timestamp DateTime
) ENGINE = ReplacingMergeTree() ORDER BY user_id

-- Insert new row to "update"
INSERT INTO events_replacing VALUES (123, 'click', now())
```

{% callout type="tip" %}
Use `CollapsingMergeTree` or `ReplacingMergeTree` for "update by inserting new rows" patterns.
{% /callout %}

### Sampling

ClickHouse sampling syntax:

```sql {% title="Correct sampling" %}
SELECT * FROM events SAMPLE 0.1
SELECT * FROM events SAMPLE 1000 ROWS
```

### Transactions

ClickHouse has limited transaction support:

```sql {% title="ClickHouse transaction approach" %}
-- Use atomic operations where possible
-- Consider using Materialized Views for complex updates
```

## Advanced solutions

### Using Materialized Views

For complex data modifications:

```sql {% title="Materialized View for updates" %}
CREATE MATERIALIZED VIEW events_updated AS
SELECT
    user_id,
    CASE WHEN user_id = 123 THEN 'click' ELSE event_type END as event_type,
    timestamp
FROM events
```

### Using INSERT with deduplication

For data replacement:

```sql {% title="INSERT with deduplication" %}
INSERT INTO events_new
SELECT
    user_id,
    CASE WHEN user_id = 123 THEN 'click' ELSE event_type END as event_type,
    timestamp
FROM events
```

### Using window functions

For complex aggregations:

```sql {% title="Window functions for complex logic" %}
SELECT
    user_id,
    event_type,
    ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY timestamp) as row_num
FROM events
```

{% callout type="tip" %}
Using `WITH TOTALS` or settings `allow_experimental_window_functions = 1` may be required for window functions.
{% /callout %}

## ClickHouse-specific features

### Using ReplacingMergeTree

For handling updates:

```sql {% title="ReplacingMergeTree example" %}
CREATE TABLE events_replacing (
    user_id UInt32,
    event_type String,
    timestamp DateTime,
    version UInt32
) ENGINE = ReplacingMergeTree(version)
ORDER BY (user_id, timestamp)
```

### Using CollapsingMergeTree

For handling deletes:

```sql {% title="CollapsingMergeTree example" %}
CREATE TABLE events_collapsing (
    user_id UInt32,
    event_type String,
    timestamp DateTime,
    sign Int8
) ENGINE = CollapsingMergeTree(sign)
ORDER BY (user_id, timestamp)
```

## Feature compatibility

### MySQL to ClickHouse

| MySQL Feature | ClickHouse Alternative | Description |
|---------------|----------------------|-------------|
| `FOR UPDATE` | Not supported | Use appropriate table engines |
| `LIMIT x,y` | `LIMIT y OFFSET x` | Pagination syntax |
| `UPDATE` | `INSERT` with deduplication | Data modification |
| `DELETE` | `INSERT` with sign column | Data deletion |

### PostgreSQL to ClickHouse

| PostgreSQL Feature | ClickHouse Alternative | Description |
|-------------------|----------------------|-------------|
| `OFFSET x ROWS FETCH NEXT y ROWS` | `LIMIT y OFFSET x` | Pagination syntax |
| `JSONB` | `String` with JSON functions | JSON handling |
| `UPDATE` | `INSERT` with deduplication | Data modification |
| `RETURNING` | Not supported | Use separate SELECT |

## Tinybird-specific notes

In Tinybird, this error often occurs when:

* Using unsupported ClickHouse features in Pipes
* Trying to use features not available in Tinybird's ClickHouse version
* Using client-specific methods that aren't supported
* Working with Materialized Views that use unsupported operations

To debug in Tinybird:

1. Check Tinybird's ClickHouse version and supported features
2. Use the Query Builder to test operations
3. Consult Tinybird documentation for supported features
4. Use alternative approaches for unsupported operations

## Best practices

### Feature compatibility

* Check ClickHouse documentation before using new features
* Test operations in development environment first
* Use version-specific feature checks
* Keep up with ClickHouse updates and changes

### Alternative approaches

* Use Materialized Views for complex data modifications
* Implement logic in application layer when needed
* Use INSERT with deduplication for updates
* Consider using specialized table engines

### Error handling

* Implement proper error handling for unsupported features
* Have fallback approaches ready
* Log unsupported feature attempts
* Document workarounds for common issues

## See also

* [ClickHouse Table Engines](/sql-reference/engines)
* [Working with Data Sources](/forward/core-concepts/data-sources)
* [Common function errors](/sql-reference/clickhouse-errors/UNSUPPORTED_METHOD)
