{"id":5753,"date":"2022-05-13T21:29:47","date_gmt":"2022-05-14T04:29:47","guid":{"rendered":"https:\/\/tdengine.com\/?p=5753"},"modified":"2025-11-03T08:08:41","modified_gmt":"2025-11-03T16:08:41","slug":"tdengine-in-a-smart-heating-network-monitoring-and-energy-analysis-system","status":"publish","type":"post","link":"https:\/\/tdengine.com\/tdengine-in-a-smart-heating-network-monitoring-and-energy-analysis-system\/","title":{"rendered":"Improving Query Latency in a Smart Heating Monitoring and Analysis System"},"content":{"rendered":"\n<p>TDengine is being used to monitor an extensive heating network and in the analysis system for the consequent energy consumption. Compared with MySQL, the storage has been significantly reduced and query latency has been significantly improved. We are increasing the use of TDengine across our business lines for various applications on time-series data.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-dd05defa gb-headline-text\">Introduction<\/h2>\n\n\n\n<p>In our &#8220;smart heating&#8221; project we had started out using MySQL to store historical data. However, as the amount of data increased, query performance decreased significantly and it became difficult to meet the needs of business users.&nbsp;In order to alleviate the status quo, we started looking into TDengine, a <a href=\"https:\/\/tdengine.com\/what-is-a-time-series-database\/\">time series database<\/a> (TSDB). After doing our due diligence we realized that TDengine was really built from the ground up for IoT time-series data and that it supported SQL. We went through a comprehensive testing period before deploying TDengine in our project.<\/p>\n\n\n\n<p>Currently, we are using TDengine in the applications that we discuss in detail below.<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-d151df16 gb-headline-text\">Heating Network Monitoring&nbsp;<\/h3>\n\n\n\n<p>The heating network monitoring system currently includes both heat source monitoring and thermal station monitoring. The system monitors the operational status of heat sources and thermal stations in real-time and provides data visualization, so that operations managers can easily get an overview of the status of the entire heating network.<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-a154c77c gb-headline-text\">Energy Analysis System<\/h3>\n\n\n\n<p>The energy analysis system is used for real-time statistics, calculation, and monitoring of energy consumption, and establishes a graded energy consumption evaluation system.&nbsp;It also helps pinpoint sources of energy waste through an energy consumption ranking. This allows staff to carry out targeted improvement and optimization in order to reduce energy waste and realize real energy savings.<\/p>\n\n\n\n<p>Essentially we have found that both systems have a very high demand for real-time queries and data visualization which allows real-time management of heating sources and real-time display of energy consumption trends among many other things.<\/p>\n\n\n\n<p>For the processing of high-frequency time-series data generated by equipment, TDengine is undoubtedly a very suitable choice.&nbsp;However, due to improvements in the features offered by TDengine and performance improvements, we&nbsp;have accelerated the replacement of other database products with TDengine.<\/p>\n\n\n\n<p>Naturally, our deployment of TDengine was not without its share of issues. For example, the old version of TDengine did not support &#8220;group by&#8221; for timestamps but this was resolved after upgrading.&nbsp;Another example is that the table structure obtained by different clients during queries is different. This is because the metadata of each client&#8217;s cache is inconsistent. Again, this was resolved by using the reset query cache command.&nbsp;We have run into&nbsp;minor issues for&nbsp; which we have received timely feedback and help from the official technical support at TDengine as well as from the vast TDengine open source community.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-2d37f544 gb-headline-text\">TDengine in Production<\/h2>\n\n\n\n<p>We deployed TDengine in a three-node, three-copy cluster configuration. Each machine was configured with 16 Core, 32G RAM and a 1 TB hard drive.&nbsp;Data from our equipment is&nbsp;first collected and written to Kafka in real time, and then stored in TDengine using the Python connector library.<\/p>\n\n\n\n<p>Currently we have created more than 5,500 subtables that collectively store about 90 million rows of data. The largest <a href=\"https:\/\/tdengine.com\/supertable\/\">supertable<\/a> has nearly 73 million rows of data, and a single row is about 180 bytes.\u00a0<strong>Even with three copies, the current disk space is only 10.2G in total, thanks to the compression ratios of TDengine. This coupled with the configurable mechanism of data expiration and deletion, we basically no longer need to worry about the cost of disk storage<\/strong>\u00a0.<\/p>\n\n\n\n<p><strong>The usage rates of memory and CPU are also maintained at around 1.9% and 0.3% which has led to an extremely stable and stress-free environment.<\/strong><\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-065db0f1\"><img decoding=\"async\" width=\"1396\" height=\"344\" class=\"gb-image gb-image-065db0f1\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes.png?strip=all&amp;sharp=1 1396w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes-300x74.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes-1024x252.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes-768x189.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes.png?strip=all&amp;sharp=1&amp;w=558 558w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes.png?strip=all&amp;sharp=1&amp;w=837 837w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes.png?strip=all&amp;sharp=1&amp;w=1116 1116w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-01-dnodes.png?strip=all&amp;sharp=1&amp;w=450 450w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b2bab25b\"><img decoding=\"async\" width=\"1186\" height=\"260\" class=\"gb-image gb-image-b2bab25b\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count.png?strip=all&amp;sharp=1 1186w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count-300x66.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count-1024x224.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count-768x168.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count.png?strip=all&amp;sharp=1&amp;w=237 237w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count.png?strip=all&amp;sharp=1&amp;w=474 474w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count.png?strip=all&amp;sharp=1&amp;w=711 711w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-02-count.png?strip=all&amp;sharp=1&amp;w=948 948w\" sizes=\"(max-width: 1186px) 100vw, 1186px\" \/><\/figure>\n\n\n\n<p><strong><strong>The SQL below shows some common queries that we run which basically execute and return data in milliseconds.<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">select sum(Ep) as Ep,sum(HM_HT) as HM_HT .............. interval(1d);<\/code><\/pre>\n\n\n\n<figure class=\"gb-block-image gb-block-image-8065f1eb\"><img decoding=\"async\" width=\"1536\" height=\"389\" class=\"gb-image gb-image-8065f1eb\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1.png?strip=all&amp;sharp=1 1536w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1-300x76.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1-1024x259.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1-768x195.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1.png?strip=all&amp;sharp=1&amp;w=614 614w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1.png?strip=all&amp;sharp=1&amp;w=921 921w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1.png?strip=all&amp;sharp=1&amp;w=1228 1228w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-03-query-1.png?strip=all&amp;sharp=1&amp;w=450 450w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT AVG(heatsourcepg) AS heatsourcepg, AVG(heatsourcetg) AS heatsourcetg, AVG(heatsourcef_mtrg) AS heatsourcef_mtrg .............. FROM iot_device.source_minute WHERE ts &gt;=&quot;2022-04-06 12:00:00&quot; AND ts &lt;&quot;2022-04-06 13:00:00.000&quot; GROUP BY groupid, level<\/code><\/pre>\n\n\n\n<figure class=\"gb-block-image gb-block-image-cccfc451\"><img decoding=\"async\" width=\"1536\" height=\"245\" class=\"gb-image gb-image-cccfc451\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2.png?strip=all&sharp=1\" alt=\"\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2.png?strip=all&amp;sharp=1 1536w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2-300x48.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2-1024x163.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2-768x123.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2.png?strip=all&amp;sharp=1&amp;w=614 614w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2.png?strip=all&amp;sharp=1&amp;w=921 921w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2.png?strip=all&amp;sharp=1&amp;w=1228 1228w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/22.032-04-query-2.png?strip=all&amp;sharp=1&amp;w=450 450w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<h2 class=\"gb-headline gb-headline-78f63c9e gb-headline-text\">Conclusion<\/h2>\n\n\n\n<p>In 2019, TSCC began to actively explore new markets for smart energy services. We developed a comprehensive energy management and control system for heating, cooling, power and gas supply. We also developed a smart water supervision platform.&nbsp;A year later, we officially introduced TDengine into our smart platform and TDengine did not disappoint us.&nbsp;In the future, we expect TDengine to continuously contribute to the efficient utilization of urban energy, increasing use of clean energy, and the creation of a low-carbon smart city.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With MySQL becoming a bottleneck for storage and query latency, TSCC migrated their IoT smart heating and energy monitoring system to TDengine.<\/p>\n","protected":false},"author":81,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[23,234,268],"tags":[],"ppma_author":[167],"class_list":["post-5753","post","type-post","status-publish","format-standard","hentry","category-case-studies","category-energy","category-industrial-data"],"authors":[{"term_id":167,"user_id":81,"is_guest":0,"slug":"chait","display_name":"Chait Diwadkar","avatar_url":{"url":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-05-cdiwadkar.jpg","url2x":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-05-cdiwadkar.jpg"},"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/5753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=5753"}],"version-history":[{"count":11,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/5753\/revisions"}],"predecessor-version":[{"id":29454,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/5753\/revisions\/29454"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=5753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=5753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=5753"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=5753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}