% This is generated by ESQL's QuerySettingsTests. Do not edit it. See ../README.md for how to regenerate it.

### `approximation` [esql-approximation]
```{applies_to}
serverless: preview
stack: preview 9.4.0
```
Enables query approximation if possible for the query. A boolean value `false` (default) disables query approximation and `true` enables it with default settings. Map values enable query approximation with custom settings.

**Type**: `boolean` `map_param`

Map entries: 
    - `rows` (`[integer]`): Number of sampled rows used for approximating the query. Must be at least 10,000. Null uses the system default.
- `confidence_level` (`[double]`): Confidence level of the computed confidence intervals. Default is 0.90. Null disables computing confidence intervals.


#### Example

Approximate the sum using default settings.

```esql
SET approximation=true;
FROM many_numbers | STATS sum=SUM(sv)
```

| sum:long | _approximation_confidence_interval(sum):long | _approximation_certified(sum):boolean |
| --- | --- | --- |
| 42284250 | [41622402, 43016433] | true |

#### Example

Approximate the median based on 10,000 rows.

```esql
SET approximation={"rows":10000};
FROM many_numbers | STATS median=MEDIAN(sv)
```

| median:double | _approximation_confidence_interval(median):double | _approximation_certified(median):boolean |
| --- | --- | --- |
| 356.0 | [353.73, 358.79] | true |

