HTAP (Hybrid Transactional and Analytical Processing)
← Back to DP-420 Terminology Reference
Category: Integration & Analytics
Summary: Architecture running analytics over operational data without impacting transactional OLTP RUs, enabled via Synapse Link/analytical store.
Overview
HTAP (Hybrid Transactional and Analytical Processing) is an architectural pattern that combines transactional processing (OLTP) and analytical processing (OLAP) on the same operational data in near real time, eliminating the latency, cost, and complexity of traditional Extract-Transform-Load (ETL) pipelines. In Azure Cosmos DB, HTAP is achieved through Azure Synapse Link and the analytical store — a separate, column-oriented storage layer that automatically and continuously syncs with the row-based transactional store with no impact on transactional Request Unit (RU) performance or cost. Enabling HTAP requires enabling analytical storage at the Azure Cosmos DB account level, and then configuring analytical storage Time-to-Live (TTL) when creating or updating containers.
Example 1 (Azure CLI): Enable analytical storage (HTAP / Synapse Link) on the Cosmos DB account
# Enable analytical storage on an existing Cosmos DB account az cosmosdb update --name mycosmosaccount --resource-group myRG --enable-analytical-storage true # Alternatively, enable when creating a new Cosmos DB account az cosmosdb create --name mycosmosaccount --resource-group myRG --enable-analytical-storage true
Enabling analytical storage at the account level is a prerequisite before any container within the account can enable its analytical store.
Example 2 (Azure CLI): Create a container with analytical storage enabled
# Create a container with analytical store enabled and infinite retention (-1) az cosmosdb sql container create --account-name mycosmosaccount --resource-group myRG --database-name ecommerce --name orders --partition-key-path "/customerId" --throughput 400 --analytical-storage-ttl -1
Setting --analytical-storage-ttl -1 enables the analytical store with no expiration (data is retained indefinitely, independent of the transactional store TTL).
Example 3 (Azure CLI): Update analytical storage TTL on an existing container
# Update an existing container's analytical storage TTL (e.g. 90 days = 7776000 seconds) az cosmosdb sql container update --account-name mycosmosaccount --resource-group myRG --database-name ecommerce --name orders --analytical-storage-ttl 7776000 # Disable analytical store on a container (set analytical-storage-ttl to 0) az cosmosdb sql container update --account-name mycosmosaccount --resource-group myRG --database-name ecommerce --name orders --analytical-storage-ttl 0
Analytical storage TTL is completely separate from transactional TTL (--ttl). Setting --analytical-storage-ttl 0 disables analytical sync and retention on the container.
More Info & Links
- Microsoft Learn: Azure Synapse Link for Azure Cosmos DB overview
- Microsoft Learn: Configure and use Azure Synapse Link for Azure Cosmos DB
- Microsoft Learn: Analytical store Time-to-Live (TTL)
DP-420 Style Practice Questions
Q1. What is the core benefit of HTAP (Hybrid Transactional and Analytical Processing) in Azure Cosmos DB?
- A. Running near real-time analytics over operational data without consuming transactional RUs or maintaining complex ETL pipelines
- B. Automatically partitioning transactional data across physical regions without partition keys
- C. Compressing JSON documents into XML format for client applications
- D. Restoring database accounts to any second within 30 days via self-service portal
Q2. Which Azure CLI command enables Synapse Link / HTAP analytical storage at the Cosmos DB account level?
- A. az cosmosdb update --name --resource-group --enable-analytical-storage true
- B. az cosmosdb sql container create --enable-htap true
- C. az cosmosdb throughput migrate --type analytical
- D. az cosmosdb sql database create --analytical-store on
Q3. How do you enable analytical storage on an Azure Cosmos DB container with indefinite retention using the Azure CLI?
- A. Specify --analytical-storage-ttl -1 when creating or updating the container using az cosmosdb sql container
- B. Specify --ttl -1 on the container
- C. Run az cosmosdb sql container throughput update --max-throughput 1000
- D. Add a composite index covering all paths in the indexing policy
Answer Key
Answers are listed at the very end so you can attempt the questions first.
- Q1 (HTAP (Hybrid Transactional and Analytical Processing)): A. Running near real-time analytics over operational data without consuming transactional RUs or maintaining complex ETL pipelines — HTAP enables near real-time analytical workloads over the column-oriented analytical store while completely protecting operational OLTP performance and RU budget.
- Q2 (HTAP (Hybrid Transactional and Analytical Processing)): A. az cosmosdb update --name --resource-group --enable-analytical-storage true — Enabling analytical storage at the account level requires 'az cosmosdb update (or create) --enable-analytical-storage true'.
- Q3 (HTAP (Hybrid Transactional and Analytical Processing)): A. Specify --analytical-storage-ttl -1 when creating or updating the container using az cosmosdb sql container — --analytical-storage-ttl controls the analytical store's retention; -1 means retain analytical data forever, independent of transactional TTL (--ttl).
DP-420: Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB — term detail page