

For similar capabilities to Amazon Timestream for LiveAnalytics, consider Amazon Timestream for InfluxDB. It offers simplified data ingestion and single-digit millisecond query response times for real-time analytics. Learn more [here](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html).

# Timestream Compute Unit (TCU)
<a name="tcu"></a>

Amazon Timestream for Live Analytics measures the compute capacity allocated to you for your query needs in Timestream compute unit (TCU). One TCU comprises of 4 vCPUs and 16 GB of memory. When you run queries in Timestream for Live Analytics, the service allocates TCUs on-demand based on the complexity of your queries and the amount of data being processed. The number of TCUs that a query consumes determines the associated cost.

**Note**  
All AWS accounts that onboard to the service after April 29, 2024 will default to using TCUs for query pricing. 

**Topics**
+ [Provisioned Timestream Compute Units](provisioned-tcu.md)
+ [MaxQuery TCU](#maxquery-tcu)
+ [Billing for TCU](#billing-tcus)
+ [Configuring TCU](#config-tcus)
+ [Estimating required compute units](#estimate-compute-units)
+ [When to increase MaxQueryTCU](#increase-maxquery-tcu)
+ [When to decrease MaxQueryTCU](#decrease-maxquery-tcu)
+ [Monitoring usage with CloudWatch metrics](#cw-metrics-monitor-usage)
+ [Understanding variations in compute units usage](#variations-compute-units-usage)

# Provisioned Timestream Compute Units
<a name="provisioned-tcu"></a>

**Note**  
Provisioned TCU is available only in the Asia Pacific (Mumbai) region.

With provisioned Timestream Compute Units (TCUs), you can allocate a fixed number of TCUs to your account, ensuring predictable performance and cost for your queries. By provisioning TCUs, you gain greater control over compute capacity, enabling you to optimize both performance and query costs based on your application's specific needs.

**Topics**
+ [Benefits of Provisioning TCU](#provisioned-tcu.benefits)
+ [How Provisioned TCU Works](#provisioned-tcu.how-provisioned-tcu-works)
+ [Monitoring Provisioned TCU usage](#provisioned-tcu.monitoring)
+ [Modifying your Provisioned TCUs](#provisioned-tcu.modifying)
+ [Pricing for Provisioned TCUs](#provisioned-tcu.pricing)

## Benefits of Provisioning TCU
<a name="provisioned-tcu.benefits"></a>

Provisioning TCU provides several benefits for customers with dedicated workloads, including:

1. **Predictable Performance:** By allocating a fixed number of TCUs, you ensure consistent performance for your queries.

1. **Cost Control:** With provisioned TCU, you can better predict and manage your costs, as you are only charged for the duration of the provisioned TCUs.

1. **Flexibility:** Provisioned TCU ensures that your workload has dedicated compute resources and you can adjust the number of provisioned TCUs to match your workload requirements, providing the required scalability as your application’s needs change. 

## How Provisioned TCU Works
<a name="provisioned-tcu.how-provisioned-tcu-works"></a>

Each Timestream Compute Unit (TCU) is comprised of 4 vCPUs and 16GB of memory. To provision TCUs, use the AWS Management Console or the UpdateAccountSettings API operation to allocate a fixed number of TCUs to your account, which are then dedicated to your workload. This ensures predictable performance and cost for your queries. The minimum number of provisioned TCUs is 4, with subsequent increments also in multiples of 4 (e.g., 4, 8, 12, 16). Once provisioned, you can run your query workloads uninterrupted. As your workload demands change, you can adjust the provisioned TCUs using the AWS Management Console or the UpdateAccountSettings API operation at any time. However, you can only decrease the number of TCUs after a minimum of 1 hour has passed since provisioning them.

For example, if you provision 8 TCUs at 10:00 AM, you will be charged for a minimum of 1 hour, until 11:00 AM. During this time, you can increment the TCUs to 12 or more, but you cannot decrement them until 11:00 AM. 

The time it takes to provision the requested Timestream Compute Units (TCUs) in your account varies depending on the number of TCUs requested. For example, provisioning 100 TCUs could take up to 30 minutes. However, you will only be charged for the resources once they are provisioned and available to serve your query workload. To ensure a smooth experience during planned increases in usage, we recommend provisioning the required resources in advance. This allows sufficient time for the resources to become available and ensures that your workload can be handled without interruption.

## Monitoring Provisioned TCU usage
<a name="provisioned-tcu.monitoring"></a>

To monitor your provisioned TCU usage, you can use the following CloudWatch metrics:
+ **Provisioned QueryTCU:** This metric specifies the number of TCUs provisioned in your account.
+ **QueryTCU:** This metric specifies the number of TCUs used by your workload.
+ **InsufficientTCUThrottles:** This metric specifies the number of queries throttled due to insufficient compute capacity.

## Modifying your Provisioned TCUs
<a name="provisioned-tcu.modifying"></a>

You can adjust the number of provisioned Timestream Compute Units (TCUs) to match your changing workload demands using the AWS Management Console, AWS Command Line Interface (CLI), or AWS SDKs. 

To view the current number of provisioned TCUs in your account, navigate to the "Admin Dashboard" section in the AWS Management Console. From there, you can easily monitor and manage your provisioned TCUs.

In the Query Compute Settings, you can verify that the compute mode is set to "Provisioned" and view the current number of provisioned Timestream Compute Units (TCUs) in your account, which is displayed as "Active Query TCU". The default value is 0. You need to provision TCUs before you run your query workload. 

To modify the query compute settings, click the "Modify" button. For instance, if you want to increase the provisioned TCUs from 32 to 64, simply enter your desired target value (64) in the "Target Query TCU" field. Additionally, you can specify an Amazon Simple Notification Service (SNS) topic to receive a notification when the provisioning process is complete.

![\[Image of console view of modifying settings for provisioned TCUs.\]](http://docs.aws.amazon.com/timestream/latest/developerguide/images/modify-prov-tcu-settings.png)


After confirming your desired configuration by selecting "Save settings", you will see that the current request status is updated to "Pending". The "Target Query TCU" field will now reflect the desired number of compute units, which is 64 in this case, indicating that the provisioning process has been initiated and is awaiting completion.

![\[Image of console view of saving settings for provisioned TCUs.\]](http://docs.aws.amazon.com/timestream/latest/developerguide/images/query-compute-save-settings.png)


Once provisioned, the "Active Query TCU" field will be updated to reflect the new provisioned capacity of 64 Timestream Compute Units, indicating that the provisioning process is complete and the additional resources are now available for use in your account.

![\[Image of console view of new updated settings for provisioned TCUs.\]](http://docs.aws.amazon.com/timestream/latest/developerguide/images/query-compute-updated-settings.png)


To reduce the number of provisioned Timestream Compute Units (TCUs) in your account, follow the same steps as before and enter your desired target value. For example, if you want to decrease the provisioned TCUs to 16, simply set the "Target Query TCU" field to 16. Please note that you can only decrease the number of provisioned TCUs after a minimum of 1 hour has passed since the last provisioning request. This means that if you provisioned or modified your TCUs within the last hour, you will need to wait until the 1-hour window has elapsed before you can decrement the TCUs.

![\[Image of console view of reducing the number of provisioned TCUs.\]](http://docs.aws.amazon.com/timestream/latest/developerguide/images/query-modify-reduce-tcu-settings.png)


After requesting a decrease in provisioned Timestream Compute Units (TCUs), the service will decrement the TCUs when it determines it is safe to do so, which may take up to a few minutes. During this time, the "Target Query TCU" field will continue to display the desired target value, in this case, 16 TCUs, indicating the pending change. Once the decrement is complete, the "Active Query TCU" field will be updated to reflect the new provisioned capacity of 16 TCUs.

![\[Image of console view of updated reduced number of provisioned TCUs.\]](http://docs.aws.amazon.com/timestream/latest/developerguide/images/query-modify-updated-reduce-tcu-settings.png)


Once the request is successfully completed, the "Active Query TCU" field will be updated to reflect the new provisioned capacity of 16 Timestream Compute Units (TCUs). If you no longer anticipate any query workload, you can further decrement the provisioned TCUs to 0, effectively releasing all provisioned resources and stopping any associated charges.

## Pricing for Provisioned TCUs
<a name="provisioned-tcu.pricing"></a>

You are charged for the duration of the Timestream Compute Units (TCUs) provisioned in your account, with a minimum charge of 1 hour. After the first hour, the TCUs are metered per second. 

To calculate the total metered hours, multiply the number of provisioned TCUs by the duration of use. For example: If you provision 16 TCUs for 2 hours, the total metered hours are 16 TCU \$1 2 hours = 32 TCU-hours. If you provision 16 TCUs for 4 hours, then decrement to 8 TCUs and use them for 6 hours, the total metered hours are 16 TCU \$1 4 hours \$1 8 TCU \$1 6 hours = 112 TCU-hours. 

Your total spend will depend on the prevailing TCU-hour cost in your region. Please refer to the Amazon Timestream Pricing page for detailed information. 

**Best Practices for managing Provisioned TCU**

To get the most out of the Provisioned TCU feature, follow these best practices:
+ **Monitor your workload:** Monitor your workload's performance, [QueryTCU used](monitoring-cloudwatch.md) and view `InsufficientTCUThrottles` to understand your usage patterns and adjust your provisioned TCUs accordingly.
+ **Pro-active adjustment:** Increase or decrease provisioned TCUs based on observed trends and anticipated workload changes. Make adjustments for your peak and off-peak periods. 
+ **Maintain Headroom:** Maintain your consumed QueryTCU to within 80% - 90% of your ProvisionedQueryTCU to handle unexpected spikes. 
+ **Optimize Queries:** Leverage features such as Query Insights and follow Timestream Query best practices to optimize queries for reduced compute usage.
+ **Implement Retries:**Timestream for LiveAnalytics Query SDK supports a retry mechanism with a default of 3 retries. Adjust the value accordingly to handle occasional and unanticipated bursts.

## MaxQuery TCU
<a name="maxquery-tcu"></a>

This setting specifies the maximum number of compute units the service will use at any point in time to serve your queries. To run queries, you must set the minimum capacity to 4 TCUs. You can set the maximum number of TCUs in multiples of 4, for example, 4, 8, 16, 32, and so on. You're charged only for the compute resources you use for your workload. For example, if you set the maximum TCUs to 128, but consistently use only 8 TCUs. You'll be charged only for the duration during which you used the 8 TCUs. The default `MaxQueryTCU` in your account is set to 200. You can adjust `MaxQueryTCU` from 4 to 1000, using the AWS Management Console or [UpdateAccountSettings](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_UpdateAccountSettings.html) API operation with the AWS SDK or AWS CLI.

We recommend setting the `MaxQueryTCU` for your account. Setting a maximum TCU limit helps control costs by restricting the number of compute units the service can use for your query workload. This allows you to better predict and manage your query spending.

## Billing for TCU
<a name="billing-tcus"></a>

Each TCU is billed on an hourly basis with per-second granularity and for a minimum of 30 seconds. The usage unit of these compute units is TCU-hour.

When you run queries, you're billed for the TCUs used during the query execution time, measured in TCU-hours. For example:
+ Your workload uses 20 TCUs for 3 hours. You're billed for 60 TCU-hours (20 TCUs x 3 hours).
+ Your workload uses 10 TCUs for 30 minutes, and then 20 TCUs for the next 30 minutes. You're billed for 15 TCU-hours (10 TCUs x 0.5 hours \$1 20 TCUs x 0.5 hours).

The pricing per TCU-hour varies by AWS Region. Refer to [Amazon Timestream pricing](https://aws.amazon.com/timestream/pricing/) for additional details. As your workload grows, the service automatically scales the compute capacity up to the specified maximum TCU limit (`MaxQueryTCU`) to maintain consistent performance. The `MaxQueryTCU` setting acts as a ceiling for the compute capacity that the service can scale to. This setting helps you to control the number of compute resources and as a result their cost.

## Configuring TCU
<a name="config-tcus"></a>

When you onboard the service, each AWS account has a default `MaxQueryTCU` limit of 200. You can update this limit as required at any point in time using the AWS Management Console or [UpdateAccountSettings](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_UpdateAccountSettings.html) API operation with the AWS SDK or AWS CLI.

If you're unsure about the values to configure, monitor the `QueryTCU` metric for your account. This metric is available in the AWS Management Console and Amazon CloudWatch. This metric provides insight into the maximum number of TCUs used at a minute granularity. Based on historical data and your estimation of future growth, set the `MaxQueryTCU` to accommodate the spikes in your usage. We recommend having a headroom of at least 4-16 TCUs above your peak usage. For example, if your peak `QueryTCU` in the last 30 days was 128, we recommend setting `MaxQueryTCU` between 132 to 144.

## Estimating required compute units
<a name="estimate-compute-units"></a>

Compute units can process queries concurrently. To determine the number of compute units required, consider the general guidelines in the following table: 


| Concurrent queries | TCUs | 
| --- | --- | 
| 7 | 4 | 
| 14 | 8 | 
| 21 | 12 | 

**Note**  
These are general guidelines and the actual number of compute units required depends on several factors, such as:  
The effective concurrency of queries.
Query patterns.
The number of partitions scanned.
Other workload-specific characteristics.
This guideline pertains to queries that scan for the last few minutes to an hour of data and adhere to the [Timestream query best practices](queries-bp.md) and [Data modeling guidelines](data-modeling.md).
Monitor your application's performance and the `QueryTCU` metric to adjust the compute units, as required.

## When to increase MaxQueryTCU
<a name="increase-maxquery-tcu"></a>

You should consider increasing the `MaxQueryTCU` in the following scenarios:
+ Your peak query consumption is approaching or reaching the current configured maximum query TCU. We recommend setting the maximum query TCU at least 4-16 TCUs higher than your peak consumption.
+ Your queries are returning a 4xx error with the message MaxQueryTCU exceeded. If you anticipate a planned increase in your workload, revisit and adjust the configured maximum query TCU accordingly.

## When to decrease MaxQueryTCU
<a name="decrease-maxquery-tcu"></a>

You should consider decreasing the `MaxQueryTCU` in the following scenarios:
+ Your workload has a predictable and stable usage pattern, and you have a good understanding of your compute usage requirements. Lowering the maximum query TCU to within 4-16 TCU above your peak consumption can help prevent unintentional usage and costs. You can modify the value using the [UpdateAccountSettings](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_UpdateAccountSettings.html) API operation.
+ Your workload's peak usage has decreased over time, either due to changes in your application or user behavior patterns. Lowering the maximum TCU can help mitigate unintentional costs.

**Note**  
Depending on your current usage, reducing the maximum TCU limit change might take up to 24 hours to be effective. You're billed only for the TCUs that your queries actually consume. Having a higher maximum query TCU limit does not impact your costs unless those TCUs are used by your workload.

## Monitoring usage with CloudWatch metrics
<a name="cw-metrics-monitor-usage"></a>

To monitor your TCU usage, Timestream for Live Analytics provides the following CloudWatch metric: `QueryTCU`. This metric specifies the number of compute units used in a minute and is emitted every minute. You can choose to monitor the maximum and minimum TCUs used in a minute. You can also set alarms on this metric to track your query costs in real-time.

## Understanding variations in compute units usage
<a name="variations-compute-units-usage"></a>

The number of compute resources required for your queries can either increase or decrease based on several parameters. For example, data volume, data ingestion patterns, query latency, query shape, query efficiency, and query combinations that use real-time and analytical queries. These parameters can lead to either higher or lower TCU units required for your workload. In a steady state where these parameters don't change, you might observe that the number of compute units required for your workload decrease. Consequently, this can lower your monthly cost.

Additionally, if any of these parameters in your workload or data change, the number of compute units required might increase. When Timestream receives a query, depending upon the data partitions the query accesses, Timestream decides the number of compute resources to performantly address the query.

At periodic intervals, based on your ingest and query access patterns, Timestream optimizes the data layout. Timestream performs the optimization by clubbing less accessed partitions into a single partition or splitting a hot partition into multiple partitions for performance. Consequently, the compute capacity used by the same query might vary slightly at different points in time.

**Opting-in to use TCU pricing for your queries**  
As an existing user, you can do a one-time opt-in to use TCUs for better cost management and removal of per query minimum bytes metered. You can opt-in using the AWS Management Console or [UpdateAccountSettings](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_UpdateAccountSettings.html) API operation with the AWS SDK or AWS CLI. In the API operation, set the `QueryPricingModel` parameter to `COMPUTE_UNITS`.  
Opting into the compute-based pricing model is an irreversible change.