{"id":26969,"date":"2026-09-18T11:15:17","date_gmt":"2026-09-18T18:15:17","guid":{"rendered":"https:\/\/www.pingcap.com\/?post_type=article&#038;p=26969"},"modified":"2026-09-18T11:16:34","modified_gmt":"2026-09-18T18:16:34","slug":"tidb-the-ultimate-htap-database-for-modern-applications","status":"publish","type":"article","link":"https:\/\/www.pingcap.com\/ko\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/","title":{"rendered":"HTAP Database Explained: How TiDB Runs Analytics on Live Transactional Data"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Key_Takeaways\"><\/span>Key Takeaways<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An HTAP database runs transactional writes and analytical queries against the same live data, with no ETL pipeline in between.<\/li>\n\n\n\n<li>TiDB pairs two storage engines under one SQL layer: TiKV for row-based transactions, TiFlash for columnar analytics.<\/li>\n\n\n\n<li>The optimizer picks the engine per query. Point lookups go to TiKV, large aggregations go to TiFlash, and the SQL never changes.<\/li>\n\n\n\n<li>Trip.com runs real-time settlement and reporting on this model, removing the pipeline that used to sit between the two.<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">An HTAP (Hybrid Transactional and Analytical Processing) database runs transactional writes and analytical queries against the same live data, on the same system, without moving that data through an ETL pipeline first. <a href=\"https:\/\/www.pingcap.com\/what-is-tidb\/\">TiDB<\/a> implements HTAP with two storage engines under one SQL layer: TiKV handles transactional reads and writes, TiFlash handles analytical queries, and TiDB keeps the two in sync in real time rather than through a nightly batch job.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_a_Query_Gets_Routed_TiKV_vs_TiFlash\"><\/span>How a Query Gets Routed: TiKV vs TiFlash<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When an application writes a row, that write lands in TiKV, TiDB&#8217;s row-based storage engine, and commits with the same consistency guarantees as any transactional database. The write then replicates to TiFlash, TiDB&#8217;s columnar storage engine, through the Multi-Raft Learner protocol, typically within a few seconds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When a query arrives, TiDB&#8217;s optimizer decides where to send it. Point lookups and small-range scans go to TiKV. Large aggregations and full-table scans go to TiFlash, where the columnar layout reads far fewer bytes off disk to answer the same question. The application never names the engine: the same SQL statement reaches the analytical engine automatically whenever the optimizer calculates that route is faster.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Seeing_the_Routing_Decision_A_Worked_Example\"><\/span>Seeing the Routing Decision: A Worked Example<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The routing behavior above is observable rather than theoretical. Give a table a TiFlash replica, then read the execution plan for two different queries against it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start by adding the replica and confirming it is available before running anything against it. A replica that is still building will not receive queries.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ALTER TABLE orders SET TIFLASH REPLICA 1;\n\nSELECT TABLE_NAME, REPLICA_COUNT, AVAILABLE, PROGRESS\nFROM information_schema.tiflash_replica\nWHERE TABLE_SCHEMA = 'shop' AND TABLE_NAME = 'orders';\n\nANALYZE TABLE orders;\nSET SESSION tidb_allow_mpp = 1;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now compare two queries. The first fetches one row by primary key, the access pattern that suits row storage.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXPLAIN SELECT * FROM orders WHERE order_id = 84213;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>id            estRows  task   operator info\n--------------------------------------------------------\nPoint_Get_1   1.00     root   table:orders, handle:84213<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Plan output is abridged for readability. A point lookup resolves against TiKV; TiFlash never enters the plan.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The second aggregates across the whole table, the access pattern that suits columnar storage.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>EXPLAIN SELECT region, COUNT(*) FROM orders GROUP BY region;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>id                              task          operator info\n-----------------------------------------------------------\nTableReader_31                  root          data:ExchangeSender_30\n\u2514\u2500ExchangeSender_30             mpp&#91;tiflash]  ExchangeType: PassThrough\n  \u2514\u2500Projection_26               mpp&#91;tiflash]  Column#4\n    \u2514\u2500HashAgg_27                mpp&#91;tiflash]  group by: region\n      \u2514\u2500ExchangeReceiver_29     mpp&#91;tiflash]\n        \u2514\u2500ExchangeSender_28     mpp&#91;tiflash]  ExchangeType: HashPartition\n          \u2514\u2500HashAgg_9           mpp&#91;tiflash]  group by: region\n            \u2514\u2500TableFullScan_25  mpp&#91;tiflash]  table:orders<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Abridged and illustrative: operator IDs, row estimates, and column widths vary with your data and version. On versions before MPP, the task column reads batchCop[tiflash] instead of mpp[tiflash].<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Three things in that second plan are worth reading carefully. The task column says <code>mpp[tiflash]<\/code>, so every operator below the reader runs on TiFlash nodes rather than TiKV. <code>TableFullScan<\/code> scans 4.2 million rows without anyone worrying about it, because columnar storage reads only the <code>region<\/code> column off disk instead of every column in every row. And the plan splits into two fragments at the <code>ExchangeSender<\/code> boundaries: one doing a first-stage aggregation local to each node, one combining those partial results.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nothing in either SQL statement named an engine. The optimizer chose, using table statistics and cost estimates, which is why <code>ANALYZE<\/code> matters before you judge a routing decision. If you want to confirm what a query would do on one engine only, constrain the session rather than rewriting the query.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SET SESSION tidb_isolation_read_engines = 'tidb,tiflash';\nEXPLAIN SELECT region, COUNT(*) FROM orders GROUP BY region;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That is a diagnostic, not a production setting. In normal operation the point is that the same application, issuing the same SQL, reaches whichever engine answers it faster.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_HTAP_Replaces_The_ETL_Pipeline\"><\/span>What HTAP Replaces: The ETL Pipeline<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Without HTAP, running analytics on transactional data usually means a separate OLAP warehouse that a batch ETL job feeds hourly or nightly. That pipeline costs you three things:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Staleness, so the dashboard always trails production by hours.<\/li>\n\n\n\n<li>Duplicated infrastructure, so you run and pay for two databases.<\/li>\n\n\n\n<li>An added failure point, because a broken ETL job goes stale quietly rather than loudly.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">TiDB&#8217;s real-time TiFlash replication removes all three. One cluster holds one copy of the data, replicated for two access patterns, with no batch job left to break.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Verified_Result_Tripcom\"><\/span>Verified Result: Trip.com<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.pingcap.com\/case-study\/trip-com-boosts-real-time-data-processing-and-financial-settlement-with-tidb\/\">Trip.com<\/a> adopted TiDB to speed up real-time data processing and financial settlement, workloads that need transactional accuracy and near-instant analytical visibility on the same data. Running both on TiDB&#8217;s HTAP architecture removed the separate settlement and reporting pipeline that would otherwise sit between the transactional system and the numbers its finance teams need to see.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Two_Engines_One_Source_of_Truth\"><\/span>Two Engines, One Source of Truth<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">An HTAP database removes the pipeline between what happened and what it means. It does that not by making one engine do two jobs badly, but by running two engines that stay in sync automatically, each shaped for the access pattern it serves.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start with a <a href=\"https:\/\/www.pingcap.com\/tidb\/cloud\/\">free TiDB Cloud Starter cluster<\/a> to test HTAP query routing against your own schema and see which of your queries the optimizer sends to TiFlash.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"HTAP_Database_FAQs\"><\/span>HTAP Database FAQs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What Does HTAP Stand For, and What Problem Does It Solve?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">HTAP stands for Hybrid Transactional and Analytical Processing. It solves the staleness and duplicated-infrastructure problem created by running a separate OLTP database and OLAP warehouse connected by a pipeline. In an HTAP system, transactions and analytics run against the same live data on one system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Does an HTAP Database Sacrifice Transactional Performance for Analytics?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In TiDB&#8217;s design, no. TiKV carries the transactional load independently of TiFlash, and analytical queries route to TiFlash, so the two workloads never compete for the same storage engine. Replication to TiFlash runs asynchronously, so it does not block transactional writes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How Is HTAP Different From Running Analytics on a Read Replica?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A read replica adds read capacity but keeps row-based storage, which stays slow for large aggregations no matter how fresh the data is. TiFlash adds a different storage engine entirely: columnar, built for analytical scan patterns. The difference is which access pattern the engine serves, not how much read capacity you add.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Discover TiDB&#8217;s power in HTAP workloads, offering scalability, MySQL compatibility, and multi-cloud resilience for data-heavy apps.<\/p>","protected":false},"author":218,"featured_media":0,"template":"","class_list":["post-26969","article","type-article","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HTAP Database Explained: TiDB&#039;s Real-Time Model (2026)<\/title>\n<meta name=\"description\" content=\"What an HTAP database actually does under the hood, how TiDB routes queries between TiKV and TiFlash, and a verified customer result.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pingcap.com\/ko\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTAP Database Explained: TiDB&#039;s Real-Time Model (2026)\" \/>\n<meta property=\"og:description\" content=\"What an HTAP database actually does under the hood, how TiDB routes queries between TiKV and TiFlash, and a verified customer result.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pingcap.com\/ko\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/\" \/>\n<meta property=\"og:site_name\" content=\"TiDB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/pingcap2015\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-18T18:16:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.pingcap.com\/files\/2024\/09\/11005522\/Homepage-Ad.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1440\" \/>\n\t<meta property=\"og:image:height\" content=\"714\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@PingCAP\" \/>\n<meta name=\"twitter:label1\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data1\" content=\"5\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/article\\\/tidb-the-ultimate-htap-database-for-modern-applications\\\/\",\"url\":\"https:\\\/\\\/www.pingcap.com\\\/article\\\/tidb-the-ultimate-htap-database-for-modern-applications\\\/\",\"name\":\"HTAP Database Explained: TiDB's Real-Time Model (2026)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/#website\"},\"datePublished\":\"2026-09-18T18:15:17+00:00\",\"dateModified\":\"2026-09-18T18:16:34+00:00\",\"description\":\"What an HTAP database actually does under the hood, how TiDB routes queries between TiKV and TiFlash, and a verified customer result.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/article\\\/tidb-the-ultimate-htap-database-for-modern-applications\\\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pingcap.com\\\/article\\\/tidb-the-ultimate-htap-database-for-modern-applications\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/article\\\/tidb-the-ultimate-htap-database-for-modern-applications\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pingcap.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\\\/\\\/www.pingcap.com\\\/article\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"HTAP Database Explained: How TiDB Runs Analytics on Live Transactional Data\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pingcap.com\\\/\",\"name\":\"TiDB\",\"description\":\"TiDB | SQL at Scale\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pingcap.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/#organization\",\"name\":\"PingCAP\",\"url\":\"https:\\\/\\\/www.pingcap.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/static.pingcap.com\\\/files\\\/2021\\\/11\\\/pingcap-logo.png\",\"contentUrl\":\"https:\\\/\\\/static.pingcap.com\\\/files\\\/2021\\\/11\\\/pingcap-logo.png\",\"width\":811,\"height\":232,\"caption\":\"PingCAP\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pingcap.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/pingcap2015\",\"https:\\\/\\\/x.com\\\/PingCAP\",\"https:\\\/\\\/linkedin.com\\\/company\\\/pingcap\",\"https:\\\/\\\/youtube.com\\\/channel\\\/UCuq4puT32DzHKT5rU1IZpIA\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTAP Database Explained: TiDB's Real-Time Model (2026)","description":"What an HTAP database actually does under the hood, how TiDB routes queries between TiKV and TiFlash, and a verified customer result.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pingcap.com\/ko\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/","og_locale":"ko_KR","og_type":"article","og_title":"HTAP Database Explained: TiDB's Real-Time Model (2026)","og_description":"What an HTAP database actually does under the hood, how TiDB routes queries between TiKV and TiFlash, and a verified customer result.","og_url":"https:\/\/www.pingcap.com\/ko\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/","og_site_name":"TiDB","article_publisher":"https:\/\/facebook.com\/pingcap2015","article_modified_time":"2026-09-18T18:16:34+00:00","og_image":[{"width":1440,"height":714,"url":"https:\/\/static.pingcap.com\/files\/2024\/09\/11005522\/Homepage-Ad.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@PingCAP","twitter_misc":{"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"5\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pingcap.com\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/","url":"https:\/\/www.pingcap.com\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/","name":"HTAP Database Explained: TiDB's Real-Time Model (2026)","isPartOf":{"@id":"https:\/\/www.pingcap.com\/#website"},"datePublished":"2026-09-18T18:15:17+00:00","dateModified":"2026-09-18T18:16:34+00:00","description":"What an HTAP database actually does under the hood, how TiDB routes queries between TiKV and TiFlash, and a verified customer result.","breadcrumb":{"@id":"https:\/\/www.pingcap.com\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pingcap.com\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pingcap.com\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pingcap.com\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/www.pingcap.com\/article\/"},{"@type":"ListItem","position":3,"name":"HTAP Database Explained: How TiDB Runs Analytics on Live Transactional Data"}]},{"@type":"WebSite","@id":"https:\/\/www.pingcap.com\/#website","url":"https:\/\/www.pingcap.com\/","name":"\ud2f0DB","description":"TiDB | SQL at Scale","publisher":{"@id":"https:\/\/www.pingcap.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pingcap.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/www.pingcap.com\/#organization","name":"PingCAP","url":"https:\/\/www.pingcap.com\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/","url":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","contentUrl":"https:\/\/static.pingcap.com\/files\/2021\/11\/pingcap-logo.png","width":811,"height":232,"caption":"PingCAP"},"image":{"@id":"https:\/\/www.pingcap.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/pingcap2015","https:\/\/x.com\/PingCAP","https:\/\/linkedin.com\/company\/pingcap","https:\/\/youtube.com\/channel\/UCuq4puT32DzHKT5rU1IZpIA"]}]}},"card_markup":"        <a class=\"card-article\" href=\"https:\/\/www.pingcap.com\/ko\/article\/tidb-the-ultimate-htap-database-for-modern-applications\/\">            <h3>HTAP Database Explained: How TiDB Runs Analytics on Live Transactional Data<\/h3>            <p>Discover TiDB's power in HTAP workloads, offering scalability, MySQL compatibility, and multi-cloud resilience for data-heavy apps.<\/p>        <\/a>","_links":{"self":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/article\/26969","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/types\/article"}],"author":[{"embeddable":true,"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/users\/218"}],"wp:attachment":[{"href":"https:\/\/www.pingcap.com\/ko\/wp-json\/wp\/v2\/media?parent=26969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}