{"id":6237,"date":"2022-06-06T07:15:57","date_gmt":"2022-06-06T14:15:57","guid":{"rendered":"https:\/\/tdengine.com\/?p=6237"},"modified":"2025-08-26T19:00:30","modified_gmt":"2025-08-27T02:00:30","slug":"tdengine-2-6-is-now-available","status":"publish","type":"post","link":"https:\/\/tdengine.com\/tdengine-2-6-is-now-available\/","title":{"rendered":"TDengine 2.6 Is Now Available"},"content":{"rendered":"\n<p>The TDengine team has just released TDengine 2.6. The new version of this <a href=\"https:\/\/tdengine.com\/what-is-a-time-series-database\/\">time-series database<\/a> (TSDB) brings many new features, including optimized SQL execution and a large number of computing and analytics functions to support more usage scenarios. There are also some bug fixes. <\/p>\n\n\n\n<p>Some important updates in TDengine 2.6 are listed below.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-5ac123c6 gb-headline-text\">SQL Syntax<\/h2>\n\n\n\n<h3 class=\"gb-headline gb-headline-082a6c84 gb-headline-text\">Support TIMESTAMP shortcut format with only the date part.<\/h3>\n\n\n\n<p>For example, &#8220;2022-02-02&#8221; will be automatically translated to &#8220;2022-02-02 00:00:00&#8221;. If we execute the following statement in previous versions:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">select last(ts), sum(f1) from t1987 where ts&gt;=&quot;2017-07-15&quot; interval(1m) ;\n<\/code><\/pre>\n\n\n\n<p>TDengine will report an error:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">DB error: invalid SQL: invalid timestamp (0.000065s) \n<\/pre>\n\n\n\n<p>Therefore we have to write as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">select last(ts), sum(f1) from t1987 where ts&gt;=&quot;2017-07-15 00:00:00.000&quot; interval(1m)\n<\/code><\/pre>\n\n\n\n<p>In TDengine 2.6, we can provide only the date part.<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-d2d0246d gb-headline-text\">Restrict <code class=\"\" data-line=\"\">like<\/code> to be followed only by strings<\/h3>\n\n\n\n<h3 class=\"gb-headline gb-headline-d58047a8 gb-headline-text\">Add some time window related keywords<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code class=\"\" data-line=\"\">_QSTART<\/code>\/<code class=\"\" data-line=\"\">_QSTOP<\/code>\/<code class=\"\" data-line=\"\">_QDURATION<\/code><\/li>\n<\/ul>\n\n\n\n<p>The start, stop and duration of a query time window.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code class=\"\" data-line=\"\">_WSTART<\/code>\/<code class=\"\" data-line=\"\">_WSTOP<\/code>\/<code class=\"\" data-line=\"\">_WDURATION<\/code><\/li>\n<\/ul>\n\n\n\n<p>The start, stop and duration of aggegate query by time window, like interval, session window, state window. <\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">taos&gt; \n<strong>select<\/strong> * <strong>from<\/strong> tb_i;\n           \nts                      |           c0|\n========================================\n \n2022-02-02 02:00:00.000 |           0 |\n \n2022-02-02 02:00:01.000 |           1 |\n \n2022-02-02 02:00:02.000 |           2 |\n \n2022-02-02 02:00:03.000 |           3 |\n \n2022-02-02 02:00:04.000 |           4 |\n \n2022-02-02 02:00:05.000 |           5 |\nQuery OK, 6 row(s) in <strong>set<\/strong> (0.007324s)\n \ntaos&gt; <strong>select<\/strong> _wstart,_wstop,_wduration, avg(c0) <strong>from <\/strong>tb_i interval (1s);\n           \nts                      |    _wstart              |         _wstop          <meta charset=\"utf-8\">|_wduration   | avg(c0)  |\n==============================<meta charset=\"utf-8\">===================================================<meta charset=\"utf-8\">================\n \n2022-02-02 02:00:00.000 | 2022-02-02 02:00:00.000 | 2022-02-02 02:00:00.999 | 999 | 0.000000000 |\n \n2022-02-02 02:00:01.000 | 2022-02-02 02:00:01.000 | 2022-02-02 02:00:01.999 | 999 | 1.000000000 |\n \n2022-02-02 02:00:02.000 | 2022-02-02 02:00:02.000 | 2022-02-02 02:00:02.999 | 999 | 2.000000000 |\n \n2022-02-02 02:00:03.000 | 2022-02-02 02:00:03.000 | 2022-02-02 02:00:03.999 | 999 | 3.000000000 |\n \n2022-02-02 02:00:04.000 | 2022-02-02 02:00:04.000 | 2022-02-02 02:00:04.999 | 999 | 4.000000000 |\n \n2022-02-02 02:00:05.000 | 2022-02-02 02:00:05.000 | 2022-02-02 02:00:05.999 | 999 | 5.000000000 |\nQuery OK, 6 row(s)  in  <strong>set<\/strong> (0.003594s)\n<\/pre>\n\n\n\n<h2 class=\"gb-headline gb-headline-87677e2b gb-headline-text\">New Functions<\/h2>\n\n\n\n<h3 class=\"gb-headline gb-headline-6dad6d31 gb-headline-text\"><strong>Aggregate Functions<\/strong><\/h3>\n\n\n\n<p>HYPERLOGLOG() :The cardinal number of a specific database column is returned by using the hyperloglog algorithm. The benefit of using the hyperloglog algorithm is that the memory usage is under control when the data volume is huge.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } &#091;WHERE clause];\n<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">taos&gt; select dbig from shll;\n     dbig          |\n========================\n       1           |\n       1           |\n       1           |\n       NULL        |\n       2           |\n       19          |\n       NULL        |\n       9           |\nQuery OK, 8 row(s) in set (0.003755s)\n\ntaos&gt; select hyperloglog(dbig) from shll;\n  hyperloglog(dbig)|\n========================\n       4           |\nQuery OK, 1 row(s) in set (0.008388s)\n<\/pre>\n\n\n\n<p>MODE(): The value which has the highest frequency of occurrence. NULL is returned if there are multiple values which have the highest frequency of occurrence. <\/p>\n\n\n\n<p>HISTOGRAM(): Returns count of data points in user-specified ranges. <\/p>\n\n\n\n<p>ELAPSED(): It can be used to calculate the continuous time length in which there is valid data.<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-0d88ed06 gb-headline-text\">Time Related Functions<\/h3>\n\n\n\n<p>NOW(): The current time of the database client side system. <\/p>\n\n\n\n<p>TODAY(): The timestamp of 00:00:00 of the database client side system. <\/p>\n\n\n\n<p>TIMEZONE(): The timezone of the client side system. <\/p>\n\n\n\n<p>TO_ISO8601(): The ISO8601 date\/time format converted from a UNIX timestamp, plus the timezone of the client side system. <\/p>\n\n\n\n<p>TO_UNIXTIMESTAMP(): UNIX timestamp converted from a string of date\/time format.<\/p>\n\n\n\n<p>TIMETRUNCATE(): Truncate the input timestamp with unit specified by <code class=\"\" data-line=\"\">time_unit<\/code>.<\/p>\n\n\n\n<p>TIMEDIFF():The difference between two timestamps, and rounded to the time unit specified by <code class=\"\" data-line=\"\">time_unit<\/code>.<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-8d783f88 gb-headline-text\">String Functions<\/h3>\n\n\n\n<p>LOWER(): Convert the input string to lower case. <\/p>\n\n\n\n<p>UPPER(): Convert the input string to upper case. <\/p>\n\n\n\n<p>CONCAT(): The concatenation result of two or more strings. <\/p>\n\n\n\n<p>CONCAT_WS(): The concatenation result of two or more strings with separator. <\/p>\n\n\n\n<p>SUBSTR(): The sub-string. <\/p>\n\n\n\n<p>LENGTH(): The length in bytes of a string. <\/p>\n\n\n\n<p>CHAR_LENGTH(): The length in number of characters of a string.<\/p>\n\n\n\n<h3 class=\"gb-headline gb-headline-b6a4657d gb-headline-text\">Selection Functions<\/h3>\n\n\n\n<p>TAIL(): The next <em>k<\/em> rows are returned after skipping the last <code class=\"\" data-line=\"\">offset_val<\/code> rows, NULL values are not ignored. <code class=\"\" data-line=\"\">offset_val<\/code> is an optional parameter. When it&#8217;s not specified, the last <em>k<\/em> rows are returned.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} &#091;WHERE clause];\n<\/code><\/pre>\n\n\n\n<p>UNIQUE(): The values that occur the first time in the specified column. The effect is similar to <code class=\"\" data-line=\"\">distinct<\/code> keyword, but it can also be used to match tags or timestamp.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code class=\"\" data-line=\"\">SELECT UNIQUE(field_name) FROM {tb_name | stb_name} &#091;WHERE clause];\n<\/code><\/pre>\n\n\n\n<h3 class=\"gb-headline gb-headline-6fb68ab5 gb-headline-text\">Other Scalar Functions<\/h3>\n\n\n\n<p>STATEDURATION(): The length of time range in which all rows satisfy the specified condition for a specific column. The result is shown as an extra column for each row. <\/p>\n\n\n\n<p>STATECOUNT(): The number of continuous rows satisfying the specified conditions for a specific column. The result is shown as an extra column for each row. <\/p>\n\n\n\n<p>CAST(): It&#8217;s used for type casting. The input parameter <code class=\"\" data-line=\"\">expression<\/code> can be data columns, constants, scalar functions or arithmetic between them. Can&#8217;t be used with tags, and can only be used in <code class=\"\" data-line=\"\">select<\/code> clause. <\/p>\n\n\n\n<p>MAVG(): The moving average of continuous <em>k<\/em> values of a specific column. If the number of input rows is less than <em>k<\/em>, nothing is returned. The applicable range of <em>k<\/em> is [1,1000]. <\/p>\n\n\n\n<p>Typical mathematical functions, such as ABS(), COS(), LOG(), etc. <\/p>\n\n\n\n<p>Enhanced DIFF() function to support ignoring negative values.<\/p>\n\n\n\n<h2 class=\"gb-headline gb-headline-fc2329a6 gb-headline-text\">taosAdapter Update<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>taosAdapter supports Prometheus <code class=\"\" data-line=\"\">remote_read<\/code> and <code class=\"\" data-line=\"\">remote_write<\/code>.<\/li>\n\n\n\n<li>taosAdapter adds a new RESTful interface to support unlimited data batch pulling functions, which ensures that the application can obtain query results of any size and greatly reduces the query latency.<\/li>\n\n\n\n<li>JDBC-RESTful supports taosAdapter for multiple batch returns of data results.<\/li>\n<\/ol>\n\n\n\n<p>We also fixed some bugs found in the previous versions. Please refer to the <a href=\"https:\/\/github.com\/taosdata\/TDengine\/releases\/tag\/ver-2.6.0.0\" target=\"_blank\" rel=\"noreferrer noopener\">release note<\/a> for details. Now you can download the <a href=\"https:\/\/tdengine.com\/downloads\/\" target=\"_blank\" rel=\"noreferrer noopener\">binaries<\/a> or get the <a href=\"https:\/\/github.com\/taosdata\/TDengine\" target=\"_blank\" rel=\"noreferrer noopener\">source code<\/a> of TDengine 2.6. In addition, the enterprise version of TDengine provides the DELETE function to delete data from a specified table or supertable. Please contact us for trial.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article contains the release notes for TDengine 2.6.<\/p>\n","protected":false},"author":102,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[22],"tags":[],"ppma_author":[181],"class_list":["post-6237","post","type-post","status-publish","format-standard","hentry","category-news"],"authors":[{"term_id":181,"user_id":102,"is_guest":0,"slug":"tdengine-team","display_name":"TDengine Team","avatar_url":{"url":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-01-tdengine.png","url2x":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-01-tdengine.png"},"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/6237","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\/102"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=6237"}],"version-history":[{"count":9,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/6237\/revisions"}],"predecessor-version":[{"id":28103,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/6237\/revisions\/28103"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=6237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=6237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=6237"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=6237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}