# Cartesian Join Explosion

### Condition

Cartesian join causes uncontrolled explosion of result set for `RUNNING` query.

### How to fix

* Check join conditions and actual data in joined columns. Make sure the join condition is correct.
* Consider adding additional filters to reduce the scale of explosion. Avoid many-to-many joins.
* Avoid joins without equality condition.

### Example

```
    CartesianJoinExplosionCondition(
        min_output_rows=10_000_000,  # join emits at least 10M output rows
        min_explosion_rate=10,  # ratio of output rows to input rows is at least 10x
        warning_duration=60 * 10,  # 10 minutes for warning
        kill_duration=60 * 20,  # 20 minutes for kill
    ),
```

### Specific arguments

* **min\_output\_rows** (int) - how many rows should be produced by `CartesianJoin` (recommended min value is at least 1 million to prevent false positives)
* **min\_explosion\_rate** (float) - how many times number of output rows produced by `CartesianJoin` is higher than number of input rows (recommended min value is at least 5)
