# Aggregations

Statful is able to aggregate metrics it receives within a certain time interval. When specifying an aggregation, Statful stores the computed value (calculated based on the chosen mathematical function and time interval) and discards all the received metrics within the given interval. This allows reducing the amount of data stored when resolution up to the second is not necessary.

### Aggregation Functions

The following aggregation functions are supported:

**avg**- computes the average of numeric values that were ingested within a time interval.**count**- counts the number of values that have been ingested within a time interval.**sum**- sums up numeric values that were ingested within a time interval.**first**- returns the first value received within the time interval.**last**- returns the last value received within the time interval.**p90**- allows establishing a threshold of acceptance (e.g., when 90% of the observed values within a time interval, occur). For example, you can decide to examine data that scored below the 90th percentile of the observed values.**p95**- allows establishing a threshold of acceptance (e.g., when 95% of the observed values within a time interval, occur). For example, you can decide to examine data that scored below the 95th percentile of the observed values.**p99**- allows establishing a threshold of acceptance (e.g., when 99% of the observed values within a time interval, occur). For example, you can decide to examine data that scored below the 99th percentile of the observed values.**min**- returns the minimum value from the numeric values ingested within a time interval.**max**- returns the maximum value from the numeric values ingested within a time interval.

Aggregations are always related to an aggregation frequency, that defines the time interval to be considered. This interval is the time in which Statful is buffering metrics before calculating (and storing) the final result.

### Aggregation Frequencies

The following aggregation frequencies are supported:

- 10 seconds
- 30 seconds
- 60 seconds
- 120 seconds
- 180 seconds
- 300 seconds

Although aggregations can be used they are not mandatory which means clients can send and store raw data points with a resolution up to the second.