<a id="flink-statement-cfu"></a>

# Statement CFU Metrics in Confluent Cloud for Apache Flink

A *statement CFU metric* reports the Confluent Flink Units (CFUs) that an
individual Flink SQL statement consumes over time, so you can attribute
compute pool usage to specific statements in Confluent Cloud for Apache Flink®. Use these
metrics to monitor per-statement cost, track how a compute pool’s resources
are distributed, and identify high-consumption statements to optimize.

<a id="flink-statement-cfu-how-to-use"></a>

## How to use statement CFU metrics

The statement CFU metrics give you insights into the resources that
individual statements running inside your compute pools consume.

Specifically, the statement CFU metrics enable you to:

- **Monitor individual statement usage**: Accurately measure the number of CFUs
  each statement consumes over time. This metric is available for all types
  of statements that you submit in Confluent Cloud for Apache Flink.
- **Track resource distribution**: Understand how Confluent Cloud for Apache Flink distributes the
  resources in a compute pool among the statements that run in the compute
  pool.
- **Identify high-consumption statements**: Pinpoint which statements consume
  the most CFUs, enabling you to optimize the statement’s Flink SQL
  code or adjust the resources available to this statement.

By monitoring statement-level CFU consumption, you can make informed decisions
about your Flink application’s cost efficiency and resource utilization.

You can’t set minimum or maximum CFU limits on individual statements, but
maximum CFU limits are configurable at the compute-pool level.

<a id="flink-statement-cfu-viewing"></a>

## Where to view statement CFU metrics

The statement CFU consumption metrics are available to view in the statements
summary table and in the statement side panel.

- **Statements summary table**: Get an overview of CFU consumption for all your
  statements directly within the statements summary table. This provides a
  quick way to identify the most resource-intensive statements.
- **Statement side panel**: For a deeper dive into a statement’s resource
  usage, open the statement side panel, where you can see the current CFU
  consumption and a time-series chart that shows how the statement’s CFU
  consumption has evolved over time.

<a id="flink-statement-cfu-udf-resources"></a>

## How UDF resource consumption is represented

The statement CFU metric shows the resources that your SQL statements consume,
along with the resources that any UDF instances the statement might invoke
consume.

Resources that individual UDF instances consume sometimes appear as
fractional CFU values, because Confluent Cloud for Apache Flink can consolidate (or roll) multiple
UDF instances into a single CFU of resources. Confluent Cloud for Apache Flink can combine up to four
instances of a UDF into one CFU.

The distribution of CFUs among UDFs in a compute pool is flexible. Confluent Cloud for Apache Flink
can roll four UDF instances across different statements into a single CFU, as
long as the statements are in the same compute pool. Also, Confluent Cloud for Apache Flink can
consolidate different UDF functions and their instances into a single CFU, as
long as they are in the same compute pool.

<a id="flink-statement-cfu-compute-pool-and-statement-cfus"></a>

## Understanding differences between CFUs for compute pool and statement

When monitoring resource consumption in Confluent Cloud for Apache Flink, you might observe minor
differences between your compute pool CFU metrics and the aggregated sum of
your statement CFU metrics. These discrepancies are expected and are caused by
rounding.

If your statements use UDFs, you might see a maximum discrepancy of 2 CFUs
between the compute pool CFU metrics and the total sum of your statement CFU
metrics.

For statements not using UDFs, the maximum expected discrepancy between
the compute pool CFU metrics and the total sum of your statement CFU metrics
is 1 CFU.

#### NOTE
Confluent bills you based on the compute pool CFU metrics, not on the
summed total of individual statement CFU metrics.

## Related content

- [Billing](flink-billing.md#flink-sql-billing)
- [Compute Pools](compute-pools.md#flink-sql-compute-pools)
- [Flink SQL Statements](statements.md#flink-sql-statements)
- [Confluent Cloud Pricing](https://www.confluent.io/confluent-cloud/pricing/)
