blob: 7eb563ecf9516342fc928ca6b1e50dfeaef874e5 [file] [log] [blame]
<!doctype html>
<html lang="zh-CN" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="generator" content="VuePress 2.0.0-beta.66" />
<meta name="theme" content="VuePress Theme Hope" />
<meta property="og:url" content="https://iotdb.apache.org/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html"><meta property="og:site_name" content="IoTDB Website"><meta property="og:title" content="SQL手册"><meta property="og:description" content="1、数据库管理 创建数据库 查看数据库 删除数据库 统计数据库数量 2、时间序列管理 创建时间序列 简化版; 错误提示; 创建对齐时间序列 删除时间序列 查看时间序列 统计时间序列数量 标签点管理 重命名标签或属性; 重新设置标签或属性的值; 删除已经存在的标签或属性; 添加新的标签; 添加新的属性; 更新插入别名,标签和属性; 使用标签作为过滤条件查..."><meta property="og:type" content="article"><meta property="og:locale" content="zh-CN"><meta property="og:updated_time" content="2023-07-31T08:42:16.000Z"><meta property="article:modified_time" content="2023-07-31T08:42:16.000Z"><script type="application/ld+json">{"@context":"https://schema.org","@type":"Article","headline":"SQL手册","image":[""],"dateModified":"2023-07-31T08:42:16.000Z","author":[]}</script><link rel="icon" href="/favicon.ico"><meta name="Description" content="Apache IoTDB: Time Series Database for IoT"><meta name="Keywords" content="TSDB, time series, time series database, IoTDB, IoT database, IoT data management,时序数据库, 时间序列管理, IoTDB, 物联网数据库, 实时数据库, 物联网数据管理, 物联网数据"><meta name="baidu-site-verification" content="wfKETzB3OT"><meta name="google-site-verification" content="mZWAoRY0yj_HAr-s47zHCGHzx5Ju-RVm5wDbPnwQYFo"><title>SQL手册 | IoTDB Website</title><meta name="description" content="1、数据库管理 创建数据库 查看数据库 删除数据库 统计数据库数量 2、时间序列管理 创建时间序列 简化版; 错误提示; 创建对齐时间序列 删除时间序列 查看时间序列 统计时间序列数量 标签点管理 重命名标签或属性; 重新设置标签或属性的值; 删除已经存在的标签或属性; 添加新的标签; 添加新的属性; 更新插入别名,标签和属性; 使用标签作为过滤条件查...">
<style>
:root {
--bg-color: #fff;
}
html[data-theme="dark"] {
--bg-color: #1d1e1f;
}
html,
body {
background: var(--bg-color);
}
</style>
<script>
const userMode = localStorage.getItem("vuepress-theme-hope-scheme");
const systemDarkMode =
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches;
if (userMode === "dark" || (userMode !== "light" && systemDarkMode)) {
document.documentElement.setAttribute("data-theme", "dark");
}
</script>
<link rel="preload" href="/assets/style-35dc1830.css" as="style"><link rel="stylesheet" href="/assets/style-35dc1830.css">
<link rel="modulepreload" href="/assets/app-83ad958f.js"><link rel="modulepreload" href="/assets/SQL-Manual.html-d8424efe.js"><link rel="modulepreload" href="/assets/SQL-Manual.html-9b38dc1b.js">
</head>
<body>
<div id="app"><!--[--><!--[--><!--[--><span tabindex="-1"></span><a href="#main-content" class="vp-skip-link sr-only">跳至主要內容</a><!--]--><!--[--><div class="theme-container has-toc"><!--[--><header id="navbar" class="vp-navbar hide-icon"><div class="vp-navbar-start"><button type="button" class="vp-toggle-sidebar-button" title="Toggle Sidebar"><span class="icon"></span></button><!--[--><!----><!--]--><!--[--><a class="vp-link vp-brand" href="/zh/"><img class="vp-nav-logo" src="/logo.png" alt="IoTDB Website"><!----><span class="vp-site-name hide-in-pad">IoTDB Website</span></a><!--]--><!--[--><!----><!--]--></div><div class="vp-navbar-center"><!--[--><!----><!--]--><!--[--><!--]--><!--[--><!----><!--]--></div><div class="vp-navbar-end"><!--[--><!----><!--]--><!--[--><div id="docsearch-container"></div><nav class="vp-nav-links"><div class="nav-item hide-in-mobile"><div class="dropdown-wrapper"><button type="button" class="dropdown-title" aria-label="文档"><span class="title"><!---->文档</span><span class="arrow"></span><ul class="nav-dropdown"><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/UserGuide/V1.1.x/QuickStart/QuickStart.html"><!---->v1.1.x<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/UserGuide/V1.0.x/QuickStart/QuickStart.html"><!---->v1.0.x<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/UserGuide/V0.13.x/QuickStart/QuickStart.html"><!---->v0.13.x<!----></a></li></ul></button></div></div><div class="nav-item hide-in-mobile"><a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=177051872" rel="noopener noreferrer" target="_blank" aria-label="系统设计" class="nav-link"><!---->系统设计<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></div><div class="nav-item hide-in-mobile"><a class="vp-link nav-link" href="/zh/Download/"><!---->下载<!----></a></div><div class="nav-item hide-in-mobile"><div class="dropdown-wrapper"><button type="button" class="dropdown-title" aria-label="社区"><span class="title"><!---->社区</span><span class="arrow"></span><ul class="nav-dropdown"><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Community/About.html"><!---->关于社区<!----></a></li><li class="dropdown-item"><a href="https://cwiki.apache.org/confluence/display/iotdb" rel="noopener noreferrer" target="_blank" aria-label="Wiki" class="nav-link"><!---->Wiki<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Community/Community-Project-Committers.html"><!---->开发人员<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Community/Community-Powered-By.html"><!---->技术支持<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/Community/Materials.html"><!---->活动与报告<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Community/Feedback.html"><!---->交流与反馈<!----></a></li></ul></button></div></div><div class="nav-item hide-in-mobile"><div class="dropdown-wrapper"><button type="button" class="dropdown-title" aria-label="开发"><span class="title"><!---->开发</span><span class="arrow"></span><ul class="nav-dropdown"><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/VoteRelease.html"><!---->如何投票<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/HowToCommit.html"><!---->如何提交代码<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/HowToJoin.html"><!---->成为Contributor<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/Committer.html"><!---->成为Committer<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/ContributeGuide.html"><!---->项目开发指南<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/HowtoContributeCode.html"><!---->技术贡献指南<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/format-changelist.html"><!---->TsFile的更改列表<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link" href="/zh/Development/rpc-changelist.html"><!---->RPC变更清单<!----></a></li></ul></button></div></div><div class="nav-item hide-in-mobile"><div class="dropdown-wrapper"><button type="button" class="dropdown-title" aria-label="ASF"><span class="title"><!---->ASF</span><span class="arrow"></span><ul class="nav-dropdown"><li class="dropdown-item"><a href="https://www.apache.org/" rel="noopener noreferrer" target="_blank" aria-label="基金会" class="nav-link"><!---->基金会<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li><li class="dropdown-item"><a href="https://www.apache.org/licenses/" rel="noopener noreferrer" target="_blank" aria-label="许可证" class="nav-link"><!---->许可证<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li><li class="dropdown-item"><a href="https://www.apache.org/security/" rel="noopener noreferrer" target="_blank" aria-label="安全" class="nav-link"><!---->安全<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li><li class="dropdown-item"><a href="https://www.apache.org/foundation/sponsorship.html" rel="noopener noreferrer" target="_blank" aria-label="赞助" class="nav-link"><!---->赞助<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li><li class="dropdown-item"><a href="https://www.apache.org/foundation/thanks.html" rel="noopener noreferrer" target="_blank" aria-label="致谢" class="nav-link"><!---->致谢<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li><li class="dropdown-item"><a href="https://www.apache.org/events/current-event" rel="noopener noreferrer" target="_blank" aria-label="活动" class="nav-link"><!---->活动<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></li></ul></button></div></div></nav><div class="nav-item"><div class="dropdown-wrapper i18n-dropdown"><button type="button" class="dropdown-title" aria-label="选择语言"><!--[--><svg xmlns="http://www.w3.org/2000/svg" class="icon i18n-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="i18n icon" style="width:1rem;height:1rem;vertical-align:middle;"><path d="M379.392 460.8 494.08 575.488l-42.496 102.4L307.2 532.48 138.24 701.44l-71.68-72.704L234.496 460.8l-45.056-45.056c-27.136-27.136-51.2-66.56-66.56-108.544h112.64c7.68 14.336 16.896 27.136 26.112 35.84l45.568 46.08 45.056-45.056C382.976 312.32 409.6 247.808 409.6 204.8H0V102.4h256V0h102.4v102.4h256v102.4H512c0 70.144-37.888 161.28-87.04 210.944L378.88 460.8zM576 870.4 512 1024H409.6l256-614.4H768l256 614.4H921.6l-64-153.6H576zM618.496 768h196.608L716.8 532.48 618.496 768z"></path></svg><!--]--><span class="arrow"></span><ul class="nav-dropdown"><li class="dropdown-item"><a class="vp-link nav-link" href="/"><!---->English<!----></a></li><li class="dropdown-item"><a class="vp-link nav-link active" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html"><!---->简体中文<!----></a></li></ul></button></div></div><div class="nav-item hide-in-mobile"><button type="button" id="appearance-switch"><svg xmlns="http://www.w3.org/2000/svg" class="icon auto-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="auto icon" style="display:block;"><path d="M512 992C246.92 992 32 777.08 32 512S246.92 32 512 32s480 214.92 480 480-214.92 480-480 480zm0-840c-198.78 0-360 161.22-360 360 0 198.84 161.22 360 360 360s360-161.16 360-360c0-198.78-161.22-360-360-360zm0 660V212c165.72 0 300 134.34 300 300 0 165.72-134.28 300-300 300z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="dark icon" style="display:none;"><path d="M524.8 938.667h-4.267a439.893 439.893 0 0 1-313.173-134.4 446.293 446.293 0 0 1-11.093-597.334A432.213 432.213 0 0 1 366.933 90.027a42.667 42.667 0 0 1 45.227 9.386 42.667 42.667 0 0 1 10.24 42.667 358.4 358.4 0 0 0 82.773 375.893 361.387 361.387 0 0 0 376.747 82.774 42.667 42.667 0 0 1 54.187 55.04 433.493 433.493 0 0 1-99.84 154.88 438.613 438.613 0 0 1-311.467 128z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="light icon" style="display:none;"><path d="M952 552h-80a40 40 0 0 1 0-80h80a40 40 0 0 1 0 80zM801.88 280.08a41 41 0 0 1-57.96-57.96l57.96-58a41.04 41.04 0 0 1 58 58l-58 57.96zM512 752a240 240 0 1 1 0-480 240 240 0 0 1 0 480zm0-560a40 40 0 0 1-40-40V72a40 40 0 0 1 80 0v80a40 40 0 0 1-40 40zm-289.88 88.08-58-57.96a41.04 41.04 0 0 1 58-58l57.96 58a41 41 0 0 1-57.96 57.96zM192 512a40 40 0 0 1-40 40H72a40 40 0 0 1 0-80h80a40 40 0 0 1 40 40zm30.12 231.92a41 41 0 0 1 57.96 57.96l-57.96 58a41.04 41.04 0 0 1-58-58l58-57.96zM512 832a40 40 0 0 1 40 40v80a40 40 0 0 1-80 0v-80a40 40 0 0 1 40-40zm289.88-88.08 58 57.96a41.04 41.04 0 0 1-58 58l-57.96-58a41 41 0 0 1 57.96-57.96z"></path></svg></button></div><div class="nav-item vp-repo"><a class="vp-repo-link" href="https://github.com/apache/iotdb" target="_blank" rel="noopener noreferrer" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="icon github-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="github icon" style="width:1.25rem;height:1.25rem;vertical-align:middle;"><path d="M511.957 21.333C241.024 21.333 21.333 240.981 21.333 512c0 216.832 140.544 400.725 335.574 465.664 24.49 4.395 32.256-10.07 32.256-23.083 0-11.69.256-44.245 0-85.205-136.448 29.61-164.736-64.64-164.736-64.64-22.315-56.704-54.4-71.765-54.4-71.765-44.587-30.464 3.285-29.824 3.285-29.824 49.195 3.413 75.179 50.517 75.179 50.517 43.776 75.008 114.816 53.333 142.762 40.79 4.523-31.66 17.152-53.377 31.19-65.537-108.971-12.458-223.488-54.485-223.488-242.602 0-53.547 19.114-97.323 50.517-131.67-5.035-12.33-21.93-62.293 4.779-129.834 0 0 41.258-13.184 134.912 50.346a469.803 469.803 0 0 1 122.88-16.554c41.642.213 83.626 5.632 122.88 16.554 93.653-63.488 134.784-50.346 134.784-50.346 26.752 67.541 9.898 117.504 4.864 129.834 31.402 34.347 50.474 78.123 50.474 131.67 0 188.586-114.73 230.016-224.042 242.09 17.578 15.232 33.578 44.672 33.578 90.454v135.85c0 13.142 7.936 27.606 32.854 22.87C862.25 912.597 1002.667 728.747 1002.667 512c0-271.019-219.648-490.667-490.71-490.667z"></path></svg></a></div><!--]--><!--[--><!----><!--]--><button type="button" class="vp-toggle-navbar-button" aria-label="Toggle Navbar" aria-expanded="false" aria-controls="nav-screen"><span><span class="vp-top"></span><span class="vp-middle"></span><span class="vp-bottom"></span></span></button></div></header><!----><!--]--><!----><div class="toggle-sidebar-wrapper"><span class="arrow start"></span></div><aside id="sidebar" class="vp-sidebar"><!--[--><!----><!--]--><ul class="vp-sidebar-links"><li><section class="vp-sidebar-group"><p class="vp-sidebar-heading"><!----><span class="vp-sidebar-title">IoTDB用户手册 (V1.2.x)</span><!----></p><ul class="vp-sidebar-links"></ul></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">关于IoTDB</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">快速上手</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">基础概念</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">部署与运维</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">使用手册</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">工具体系</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">应用编程接口</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">系统集成</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable active" type="button"><!----><span class="vp-sidebar-title">SQL手册</span><span class="vp-arrow down"></span></button><ul class="vp-sidebar-links"><li><!--[--><a class="vp-link nav-link active vp-sidebar-link vp-sidebar-page active" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html"><!---->SQL手册<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、数据库管理"><!---->1、数据库管理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#创建数据库"><!---->创建数据库<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看数据库"><!---->查看数据库<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#删除数据库"><!---->删除数据库<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#统计数据库数量"><!---->统计数据库数量<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、时间序列管理"><!---->2、时间序列管理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#创建时间序列"><!---->创建时间序列<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#创建对齐时间序列"><!---->创建对齐时间序列<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#删除时间序列"><!---->删除时间序列<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看时间序列"><!---->查看时间序列<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#统计时间序列数量"><!---->统计时间序列数量<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#标签点管理"><!---->标签点管理<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_3、时间序列路径管理"><!---->3、时间序列路径管理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看路径的所有子路径"><!---->查看路径的所有子路径<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看路径的所有子节点"><!---->查看路径的所有子节点<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看设备"><!---->查看设备<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#统计节点数"><!---->统计节点数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#统计设备数量"><!---->统计设备数量<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_4、设备模板管理"><!---->4、设备模板管理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#创建元数据模板"><!---->创建元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#挂载元数据模板"><!---->挂载元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#激活元数据模板"><!---->激活元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看元数据模板"><!---->查看元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#解除元数据模板"><!---->解除元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#卸载元数据模板"><!---->卸载元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#删除元数据模板"><!---->删除元数据模板<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_5、数据存活时间管理"><!---->5、数据存活时间管理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#设置-ttl"><!---->设置 TTL<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#取消-ttl"><!---->取消 TTL<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#显示-ttl"><!---->显示 TTL<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、写入单列数据"><!---->1、写入单列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、写入多列数据"><!---->2、写入多列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_3、使用服务器时间戳"><!---->3、使用服务器时间戳<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_4、写入对齐时间序列数据"><!---->4、写入对齐时间序列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_5、加载-tsfile-文件数据"><!---->5、加载 TsFile 文件数据<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#通过指定文件路径-绝对路径-加载单-tsfile-文件"><!---->通过指定文件路径(绝对路径)加载单 tsfile 文件<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#通过指定文件夹路径-绝对路径-批量加载文件"><!---->通过指定文件夹路径(绝对路径)批量加载文件<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、删除单列数据"><!---->1、删除单列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、删除多列数据"><!---->2、删除多列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、基础查询"><!---->1、基础查询<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#时间过滤查询"><!---->时间过滤查询<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#根据一个时间区间选择多列数据"><!---->根据一个时间区间选择多列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#按照多个时间区间选择同一设备的多列数据"><!---->按照多个时间区间选择同一设备的多列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#按照多个时间区间选择不同设备的多列数据"><!---->按照多个时间区间选择不同设备的多列数据<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#根据时间降序返回结果集"><!---->根据时间降序返回结果集<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、选择表达式"><!---->2、选择表达式<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#使用别名"><!---->使用别名<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#运算符"><!---->运算符<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#函数"><!---->函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_3、最新点查询"><!---->3、最新点查询<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_4、查询对齐模式"><!---->4、查询对齐模式<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#按设备对齐"><!---->按设备对齐<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#设备对齐模式下的排序"><!---->设备对齐模式下的排序<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_5、查询过滤条件"><!---->5、查询过滤条件<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#值过滤条件"><!---->值过滤条件<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#模糊查询"><!---->模糊查询<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_6、分段分组聚合"><!---->6、分段分组聚合<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#路径层级分组聚合"><!---->路径层级分组聚合<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#标签分组聚合"><!---->标签分组聚合<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#差值分段聚合"><!---->差值分段聚合<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#条件分段聚合"><!---->条件分段聚合<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#会话分段聚合"><!---->会话分段聚合<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#点数分段聚合"><!---->点数分段聚合<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_7、聚合结果过滤"><!---->7、聚合结果过滤<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_8、结果集补空值"><!---->8、结果集补空值<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_9、查询结果分页"><!---->9、查询结果分页<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#按行分页"><!---->按行分页<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#按列分页"><!---->按列分页<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_10、查询写回-select-into"><!---->10、查询写回(SELECT INTO)<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_11、连续查询-continuous-query-cq"><!---->11、连续查询(Continuous Query, CQ)<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#语法"><!---->语法<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#连续查询的管理"><!---->连续查询的管理<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、用户自定义函数"><!---->1、用户自定义函数<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#udf-注册"><!---->UDF 注册<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#udf-卸载"><!---->UDF 卸载<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#udf-查询"><!---->UDF 查询<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查看所有注册的-udf"><!---->查看所有注册的 UDF<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、聚合函数"><!---->2、聚合函数<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#count-if"><!---->COUNT_IF<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#time-duration"><!---->TIME_DURATION<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_3、算数运算符和函数"><!---->3、算数运算符和函数<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#算数运算符"><!---->算数运算符<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#数学函数"><!---->数学函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_4、比较运算符和函数"><!---->4、比较运算符和函数<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#基本比较运算符"><!---->基本比较运算符<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#between-and-运算符"><!---->BETWEEN ... AND ... 运算符<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#模糊匹配运算符"><!---->模糊匹配运算符<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#条件函数"><!---->条件函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_5、逻辑运算符"><!---->5、逻辑运算符<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_6、字符串处理"><!---->6、字符串处理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#string-contains"><!---->STRING_CONTAINS<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#string-matches"><!---->STRING_MATCHES<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#length"><!---->Length<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#locate"><!---->Locate<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#startswith"><!---->StartsWith<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#endswith"><!---->EndsWith<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#concat"><!---->Concat<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#substring"><!---->Substring<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#replace"><!---->Replace<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#upper"><!---->Upper<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#lower"><!---->Lower<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#trim"><!---->Trim<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#strcmp"><!---->StrCmp<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#strreplace"><!---->StrReplace<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#regexmatch"><!---->RegexMatch<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#regexreplace"><!---->RegexReplace<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#regexsplit"><!---->RegexSplit<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_7、数据类型转换"><!---->7、数据类型转换<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#cast"><!---->CAST<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_8、常序列生成函数"><!---->8、常序列生成函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_9、选择函数"><!---->9、选择函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_10、区间查询函数"><!---->10、区间查询函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_11、趋势计算函数"><!---->11、趋势计算函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_12、采样函数"><!---->12、采样函数<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#等数量分桶随机采样"><!---->等数量分桶随机采样<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#等数量分桶聚合采样"><!---->等数量分桶聚合采样<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#等数量分桶-m4-采样"><!---->等数量分桶 M4 采样<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#等数量分桶离群值采样"><!---->等数量分桶离群值采样<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#m4函数"><!---->M4函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_13、时间序列处理"><!---->13、时间序列处理<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#change-points"><!---->CHANGE_POINTS<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_14、lambda-表达式"><!---->14、Lambda 表达式<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#jexl-自定义函数"><!---->JEXL 自定义函数<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_15、条件表达式"><!---->15、条件表达式<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#case"><!---->CASE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_16、数据画像"><!---->16、数据画像<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#acf"><!---->ACF<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#distinct"><!---->Distinct<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#histogram"><!---->Histogram<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#integral"><!---->Integral<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#integralavg"><!---->IntegralAvg<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#mad"><!---->Mad<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#median"><!---->Median<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#minmax"><!---->MinMax<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#mode"><!---->Mode<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#mvavg"><!---->MvAvg<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#pacf"><!---->PACF<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#percentile"><!---->Percentile<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#quantile"><!---->Quantile<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#period"><!---->Period<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#qlb"><!---->QLB<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#resample"><!---->Resample<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#sample"><!---->Sample<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#segment"><!---->Segment<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#skew"><!---->Skew<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#spline"><!---->Spline<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#spread"><!---->Spread<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#stddev"><!---->Stddev<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#zscore"><!---->ZScore<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_17、异常检测"><!---->17、异常检测<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#iqr"><!---->IQR<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#ksigma"><!---->KSigma<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#lof"><!---->LOF<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#missdetect"><!---->MissDetect<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#range"><!---->Range<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#twosidedfilter"><!---->TwoSidedFilter<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#outlier"><!---->Outlier<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_18、数据匹配"><!---->18、数据匹配<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#cov"><!---->Cov<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#dtw"><!---->Dtw<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#pearson"><!---->Pearson<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#ptnsym"><!---->PtnSym<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#xcorr"><!---->XCorr<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_19、频域分析"><!---->19、频域分析<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#conv"><!---->Conv<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#deconv"><!---->Deconv<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#dwt"><!---->DWT<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#fft"><!---->FFT<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#highpass"><!---->HighPass<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#ifft"><!---->IFFT<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#lowpass"><!---->LowPass<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_20、数据质量"><!---->20、数据质量<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#completeness"><!---->Completeness<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#consistency"><!---->Consistency<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#timeliness"><!---->Timeliness<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#validity"><!---->Validity<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#accuracy"><!---->Accuracy<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_21、数据修复"><!---->21、数据修复<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#timestamprepair"><!---->TimestampRepair<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#valuefill"><!---->ValueFill<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#valuerepair"><!---->ValueRepair<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#masterrepair"><!---->MasterRepair<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#seasonalrepair"><!---->SeasonalRepair<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_22、序列发现"><!---->22、序列发现<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#consecutivesequences"><!---->ConsecutiveSequences<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#consecutivewindows"><!---->ConsecutiveWindows<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_23、机器学习"><!---->23、机器学习<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#ar"><!---->AR<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#representation"><!---->Representation<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#rm"><!---->RM<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、使用-sql-语句注册该触发器"><!---->1、使用 SQL 语句注册该触发器<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#sql-语句示例"><!---->SQL 语句示例:<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、卸载触发器"><!---->2、卸载触发器<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#卸载触发器的-sql-语法如下"><!---->卸载触发器的 SQL 语法如下:<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#示例语句"><!---->示例语句:<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查询触发器"><!---->查询触发器<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、创建用户"><!---->1、创建用户<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、展示用户"><!---->2、展示用户<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_3、赋予用户权限"><!---->3、赋予用户权限<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_4、撤销用户权限"><!---->4、撤销用户权限<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_5、sql-语句"><!---->5、SQL 语句<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_6、非root用户限制进行的操作"><!---->6、非root用户限制进行的操作<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_1、flush"><!---->1、FLUSH<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_2、clear-cache"><!---->2、CLEAR CACHE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_3、set-system-to-readonly-running"><!---->3、SET SYSTEM TO READONLY / RUNNING<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_4、终止查询"><!---->4、终止查询<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查询超时"><!---->查询超时<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#查询终止"><!---->查询终止<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#_5、show-queries"><!---->5、SHOW QUERIES<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#语法-1"><!---->语法<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#sql示例"><!---->SQL示例<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#快速上手"><!---->快速上手<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#sql"><!---->SQL<!----></a><ul class="vp-sidebar-sub-headers"><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#show-pipesinktype"><!---->SHOW PIPESINKTYPE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#create-pipesink"><!---->CREATE PIPESINK<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#drop-pipesink"><!---->DROP PIPESINK<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#show-pipesink"><!---->SHOW PIPESINK<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#create-pipe"><!---->CREATE PIPE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#stop-pipe"><!---->STOP PIPE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#start-pipe"><!---->START PIPE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#drop-pipe"><!---->DROP PIPE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li><li class="vp-sidebar-sub-header"><a class="vp-link nav-link vp-sidebar-link vp-heading" href="/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.html#show-pipe"><!---->SHOW PIPE<!----></a><ul class="vp-sidebar-sub-headers"></ul></li></ul></li></ul><!--]--></li></ul></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">FAQ</span><span class="vp-arrow end"></span></button><!----></section></li><li><section class="vp-sidebar-group"><button class="vp-sidebar-heading clickable" type="button"><!----><span class="vp-sidebar-title">参考</span><span class="vp-arrow end"></span></button><!----></section></li></ul><!--[--><!----><!--]--></aside><!--[--><main id="main-content" class="vp-page"><!--[--><!----><!----><nav class="vp-breadcrumb disable"></nav><div class="vp-page-title"><h1><!---->SQL手册</h1><div class="page-info"><!----><!----><span class="page-date-info" aria-label="写作日期"><svg xmlns="http://www.w3.org/2000/svg" class="icon calendar-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="calendar icon"><path d="M716.4 110.137c0-18.753-14.72-33.473-33.472-33.473-18.753 0-33.473 14.72-33.473 33.473v33.473h66.993v-33.473zm-334.87 0c0-18.753-14.72-33.473-33.473-33.473s-33.52 14.72-33.52 33.473v33.473h66.993v-33.473zm468.81 33.52H716.4v100.465c0 18.753-14.72 33.473-33.472 33.473a33.145 33.145 0 01-33.473-33.473V143.657H381.53v100.465c0 18.753-14.72 33.473-33.473 33.473a33.145 33.145 0 01-33.473-33.473V143.657H180.6A134.314 134.314 0 0046.66 277.595v535.756A134.314 134.314 0 00180.6 947.289h669.74a134.36 134.36 0 00133.94-133.938V277.595a134.314 134.314 0 00-133.94-133.938zm33.473 267.877H147.126a33.145 33.145 0 01-33.473-33.473c0-18.752 14.72-33.473 33.473-33.473h736.687c18.752 0 33.472 14.72 33.472 33.473a33.145 33.145 0 01-33.472 33.473z"></path></svg><span><!----></span><meta property="datePublished" content="2023-07-31T08:42:16.000Z"></span><!----><span class="page-reading-time-info" aria-label="阅读时间"><svg xmlns="http://www.w3.org/2000/svg" class="icon timer-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="timer icon"><path d="M799.387 122.15c4.402-2.978 7.38-7.897 7.38-13.463v-1.165c0-8.933-7.38-16.312-16.312-16.312H256.33c-8.933 0-16.311 7.38-16.311 16.312v1.165c0 5.825 2.977 10.874 7.637 13.592 4.143 194.44 97.22 354.963 220.201 392.763-122.204 37.542-214.893 196.511-220.2 389.397-4.661 5.049-7.638 11.651-7.638 19.03v5.825h566.49v-5.825c0-7.379-2.849-13.981-7.509-18.9-5.049-193.016-97.867-351.985-220.2-389.527 123.24-37.67 216.446-198.453 220.588-392.892zM531.16 450.445v352.632c117.674 1.553 211.787 40.778 211.787 88.676H304.097c0-48.286 95.149-87.382 213.728-88.676V450.445c-93.077-3.107-167.901-81.297-167.901-177.093 0-8.803 6.99-15.793 15.793-15.793 8.803 0 15.794 6.99 15.794 15.793 0 80.261 63.69 145.635 142.01 145.635s142.011-65.374 142.011-145.635c0-8.803 6.99-15.793 15.794-15.793s15.793 6.99 15.793 15.793c0 95.019-73.789 172.82-165.96 177.093z"></path></svg><span>大约 31 分钟</span><meta property="timeRequired" content="PT31M"></span><!----><!----></div><hr></div><div class="toc-place-holder"><aside id="toc"><!--[--><!----><!--]--><div class="toc-header">此页内容<button type="button" class="print-button" title="打印"><svg xmlns="http://www.w3.org/2000/svg" class="icon print-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="print icon"><path d="M819.2 364.8h-44.8V128c0-17.067-14.933-32-32-32H281.6c-17.067 0-32 14.933-32 32v236.8h-44.8C145.067 364.8 96 413.867 96 473.6v192c0 59.733 49.067 108.8 108.8 108.8h44.8V896c0 17.067 14.933 32 32 32h460.8c17.067 0 32-14.933 32-32V774.4h44.8c59.733 0 108.8-49.067 108.8-108.8v-192c0-59.733-49.067-108.8-108.8-108.8zM313.6 160h396.8v204.8H313.6V160zm396.8 704H313.6V620.8h396.8V864zM864 665.6c0 25.6-19.2 44.8-44.8 44.8h-44.8V588.8c0-17.067-14.933-32-32-32H281.6c-17.067 0-32 14.933-32 32v121.6h-44.8c-25.6 0-44.8-19.2-44.8-44.8v-192c0-25.6 19.2-44.8 44.8-44.8h614.4c25.6 0 44.8 19.2 44.8 44.8v192z"></path></svg></button></div><div class="toc-wrapper"><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、数据库管理">1、数据库管理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#创建数据库">创建数据库</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看数据库">查看数据库</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#删除数据库">删除数据库</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#统计数据库数量">统计数据库数量</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、时间序列管理">2、时间序列管理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#创建时间序列">创建时间序列</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#创建对齐时间序列">创建对齐时间序列</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#删除时间序列">删除时间序列</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看时间序列">查看时间序列</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#统计时间序列数量">统计时间序列数量</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#标签点管理">标签点管理</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_3、时间序列路径管理">3、时间序列路径管理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看路径的所有子路径">查看路径的所有子路径</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看路径的所有子节点">查看路径的所有子节点</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看设备">查看设备</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#统计节点数">统计节点数</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#统计设备数量">统计设备数量</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_4、设备模板管理">4、设备模板管理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#创建元数据模板">创建元数据模板</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#挂载元数据模板">挂载元数据模板</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#激活元数据模板">激活元数据模板</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看元数据模板">查看元数据模板</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#解除元数据模板">解除元数据模板</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#卸载元数据模板">卸载元数据模板</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#删除元数据模板">删除元数据模板</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_5、数据存活时间管理">5、数据存活时间管理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#设置-ttl">设置 TTL</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#取消-ttl">取消 TTL</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#显示-ttl">显示 TTL</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、写入单列数据">1、写入单列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、写入多列数据">2、写入多列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_3、使用服务器时间戳">3、使用服务器时间戳</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_4、写入对齐时间序列数据">4、写入对齐时间序列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_5、加载-tsfile-文件数据">5、加载 TsFile 文件数据</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#通过指定文件路径-绝对路径-加载单-tsfile-文件">通过指定文件路径(绝对路径)加载单 tsfile 文件</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#通过指定文件夹路径-绝对路径-批量加载文件">通过指定文件夹路径(绝对路径)批量加载文件</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、删除单列数据">1、删除单列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、删除多列数据">2、删除多列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、基础查询">1、基础查询</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#时间过滤查询">时间过滤查询</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#根据一个时间区间选择多列数据">根据一个时间区间选择多列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#按照多个时间区间选择同一设备的多列数据">按照多个时间区间选择同一设备的多列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#按照多个时间区间选择不同设备的多列数据">按照多个时间区间选择不同设备的多列数据</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#根据时间降序返回结果集">根据时间降序返回结果集</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、选择表达式">2、选择表达式</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#使用别名">使用别名</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#运算符">运算符</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#函数">函数</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_3、最新点查询">3、最新点查询</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_4、查询对齐模式">4、查询对齐模式</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#按设备对齐">按设备对齐</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#设备对齐模式下的排序">设备对齐模式下的排序</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_5、查询过滤条件">5、查询过滤条件</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#值过滤条件">值过滤条件</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#模糊查询">模糊查询</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_6、分段分组聚合">6、分段分组聚合</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#路径层级分组聚合">路径层级分组聚合</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#标签分组聚合">标签分组聚合</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#差值分段聚合">差值分段聚合</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#条件分段聚合">条件分段聚合</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#会话分段聚合">会话分段聚合</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#点数分段聚合">点数分段聚合</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_7、聚合结果过滤">7、聚合结果过滤</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_8、结果集补空值">8、结果集补空值</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_9、查询结果分页">9、查询结果分页</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#按行分页">按行分页</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#按列分页">按列分页</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_10、查询写回-select-into">10、查询写回(SELECT INTO)</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_11、连续查询-continuous-query-cq">11、连续查询(Continuous Query, CQ)</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#语法">语法</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#连续查询的管理">连续查询的管理</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、用户自定义函数">1、用户自定义函数</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#udf-注册">UDF 注册</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#udf-卸载">UDF 卸载</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#udf-查询">UDF 查询</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查看所有注册的-udf">查看所有注册的 UDF</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、聚合函数">2、聚合函数</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#count-if">COUNT_IF</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#time-duration">TIME_DURATION</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_3、算数运算符和函数">3、算数运算符和函数</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#算数运算符">算数运算符</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#数学函数">数学函数</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_4、比较运算符和函数">4、比较运算符和函数</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#基本比较运算符">基本比较运算符</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#between-and-运算符">BETWEEN ... AND ... 运算符</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#模糊匹配运算符">模糊匹配运算符</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#条件函数">条件函数</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_5、逻辑运算符">5、逻辑运算符</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_6、字符串处理">6、字符串处理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#string-contains">STRING_CONTAINS</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#string-matches">STRING_MATCHES</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#length">Length</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#locate">Locate</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#startswith">StartsWith</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#endswith">EndsWith</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#concat">Concat</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#substring">Substring</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#replace">Replace</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#upper">Upper</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#lower">Lower</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#trim">Trim</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#strcmp">StrCmp</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#strreplace">StrReplace</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#regexmatch">RegexMatch</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#regexreplace">RegexReplace</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#regexsplit">RegexSplit</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_7、数据类型转换">7、数据类型转换</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#cast">CAST</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_8、常序列生成函数">8、常序列生成函数</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_9、选择函数">9、选择函数</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_10、区间查询函数">10、区间查询函数</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_11、趋势计算函数">11、趋势计算函数</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_12、采样函数">12、采样函数</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#等数量分桶随机采样">等数量分桶随机采样</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#等数量分桶聚合采样">等数量分桶聚合采样</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#等数量分桶-m4-采样">等数量分桶 M4 采样</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#等数量分桶离群值采样">等数量分桶离群值采样</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#m4函数">M4函数</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_13、时间序列处理">13、时间序列处理</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#change-points">CHANGE_POINTS</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_14、lambda-表达式">14、Lambda 表达式</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#jexl-自定义函数">JEXL 自定义函数</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_15、条件表达式">15、条件表达式</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#case">CASE</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_16、数据画像">16、数据画像</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#acf">ACF</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#distinct">Distinct</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#histogram">Histogram</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#integral">Integral</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#integralavg">IntegralAvg</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#mad">Mad</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#median">Median</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#minmax">MinMax</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#mode">Mode</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#mvavg">MvAvg</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#pacf">PACF</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#percentile">Percentile</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#quantile">Quantile</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#period">Period</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#qlb">QLB</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#resample">Resample</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#sample">Sample</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#segment">Segment</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#skew">Skew</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#spline">Spline</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#spread">Spread</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#stddev">Stddev</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#zscore">ZScore</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_17、异常检测">17、异常检测</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#iqr">IQR</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#ksigma">KSigma</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#lof">LOF</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#missdetect">MissDetect</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#range">Range</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#twosidedfilter">TwoSidedFilter</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#outlier">Outlier</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_18、数据匹配">18、数据匹配</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#cov">Cov</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#dtw">Dtw</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#pearson">Pearson</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#ptnsym">PtnSym</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#xcorr">XCorr</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_19、频域分析">19、频域分析</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#conv">Conv</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#deconv">Deconv</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#dwt">DWT</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#fft">FFT</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#highpass">HighPass</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#ifft">IFFT</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#lowpass">LowPass</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_20、数据质量">20、数据质量</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#completeness">Completeness</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#consistency">Consistency</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#timeliness">Timeliness</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#validity">Validity</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#accuracy">Accuracy</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_21、数据修复">21、数据修复</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#timestamprepair">TimestampRepair</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#valuefill">ValueFill</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#valuerepair">ValueRepair</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#masterrepair">MasterRepair</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#seasonalrepair">SeasonalRepair</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_22、序列发现">22、序列发现</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#consecutivesequences">ConsecutiveSequences</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#consecutivewindows">ConsecutiveWindows</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_23、机器学习">23、机器学习</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#ar">AR</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#representation">Representation</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#rm">RM</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、使用-sql-语句注册该触发器">1、使用 SQL 语句注册该触发器</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#sql-语句示例">SQL 语句示例:</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、卸载触发器">2、卸载触发器</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#卸载触发器的-sql-语法如下">卸载触发器的 SQL 语法如下:</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#示例语句">示例语句:</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#查询触发器">查询触发器</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、创建用户">1、创建用户</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、展示用户">2、展示用户</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_3、赋予用户权限">3、赋予用户权限</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_4、撤销用户权限">4、撤销用户权限</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#_5、sql-语句">5、SQL 语句</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#_6、非root用户限制进行的操作">6、非root用户限制进行的操作</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_1、flush">1、FLUSH</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_2、clear-cache">2、CLEAR CACHE</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_3、set-system-to-readonly-running">3、SET SYSTEM TO READONLY / RUNNING</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_4、终止查询">4、终止查询</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查询超时">查询超时</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#查询终止">查询终止</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#_5、show-queries">5、SHOW QUERIES</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#语法-1">语法</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#sql示例">SQL示例</a></li><!----><!--]--></ul></li><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#快速上手">快速上手</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level2" href="/#sql">SQL</a></li><li><ul class="toc-list"><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#show-pipesinktype">SHOW PIPESINKTYPE</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#create-pipesink">CREATE PIPESINK</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#drop-pipesink">DROP PIPESINK</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#show-pipesink">SHOW PIPESINK</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#create-pipe">CREATE PIPE</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#stop-pipe">STOP PIPE</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#start-pipe">START PIPE</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#drop-pipe">DROP PIPE</a></li><!----><!--]--><!--[--><li class="toc-item"><a class="vp-link toc-link level3" href="/#show-pipe">SHOW PIPE</a></li><!----><!--]--></ul></li><!--]--></ul><div class="toc-marker" style="top:-1.7rem;"></div></div><!--[--><!----><!--]--></aside></div><!----><div class="theme-hope-content"><!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
--><h1 id="sql手册" tabindex="-1"><a class="header-anchor" href="#sql手册" aria-hidden="true">#</a> SQL手册</h1><h2 id="_1、数据库管理" tabindex="-1"><a class="header-anchor" href="#_1、数据库管理" aria-hidden="true">#</a> 1、数据库管理</h2><h3 id="创建数据库" tabindex="-1"><a class="header-anchor" href="#创建数据库" aria-hidden="true">#</a> 创建数据库</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">CREATE</span> <span class="token keyword">DATABASE</span> root<span class="token punctuation">.</span>ln
<span class="token keyword">CREATE</span> <span class="token keyword">DATABASE</span> root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01
<span class="token operator">&gt;</span> Msg: <span class="token number">300</span>: root<span class="token punctuation">.</span>ln has already been created <span class="token keyword">as</span> <span class="token keyword">database</span><span class="token punctuation">.</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="查看数据库" tabindex="-1"><a class="header-anchor" href="#查看数据库" aria-hidden="true">#</a> 查看数据库</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">show</span> <span class="token keyword">databases</span>
<span class="token keyword">show</span> <span class="token keyword">databases</span> root<span class="token punctuation">.</span><span class="token operator">*</span>
<span class="token keyword">show</span> <span class="token keyword">databases</span> root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="删除数据库" tabindex="-1"><a class="header-anchor" href="#删除数据库" aria-hidden="true">#</a> 删除数据库</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">DELETE</span> <span class="token keyword">DATABASE</span> root<span class="token punctuation">.</span>ln
<span class="token keyword">DELETE</span> <span class="token keyword">DATABASE</span> root<span class="token punctuation">.</span>sgcc
<span class="token keyword">DELETE</span> <span class="token keyword">DATABASE</span> root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="统计数据库数量" tabindex="-1"><a class="header-anchor" href="#统计数据库数量" aria-hidden="true">#</a> 统计数据库数量</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code>count <span class="token keyword">databases</span>
count <span class="token keyword">databases</span> root<span class="token punctuation">.</span><span class="token operator">*</span>
count <span class="token keyword">databases</span> root<span class="token punctuation">.</span>sgcc<span class="token punctuation">.</span><span class="token operator">*</span>
count <span class="token keyword">databases</span> root<span class="token punctuation">.</span>sgcc
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="_2、时间序列管理" tabindex="-1"><a class="header-anchor" href="#_2、时间序列管理" aria-hidden="true">#</a> 2、时间序列管理</h2><h3 id="创建时间序列" tabindex="-1"><a class="header-anchor" href="#创建时间序列" aria-hidden="true">#</a> 创建时间序列</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">BOOLEAN</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span>temperature <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">FLOAT</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span>RLE
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span>hardware <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">TEXT</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">BOOLEAN</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>sgcc<span class="token punctuation">.</span>wf03<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">BOOLEAN</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>sgcc<span class="token punctuation">.</span>wf03<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span>temperature <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">FLOAT</span><span class="token punctuation">,</span>encoding<span class="token operator">=</span>RLE
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>简化版</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">BOOLEAN</span> encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span>temperature <span class="token keyword">FLOAT</span> encoding<span class="token operator">=</span>RLE
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span>hardware <span class="token keyword">TEXT</span> encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">BOOLEAN</span> encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>sgcc<span class="token punctuation">.</span>wf03<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">BOOLEAN</span> encoding<span class="token operator">=</span>PLAIN
<span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>sgcc<span class="token punctuation">.</span>wf03<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span>temperature <span class="token keyword">FLOAT</span> encoding<span class="token operator">=</span>RLE
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>错误提示</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">WITH</span> DATATYPE<span class="token operator">=</span><span class="token keyword">BOOLEAN</span><span class="token punctuation">,</span> ENCODING<span class="token operator">=</span>TS_2DIFF
<span class="token operator">&gt;</span> error: encoding TS_2DIFF does <span class="token operator">not</span> support <span class="token keyword">BOOLEAN</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="创建对齐时间序列" tabindex="-1"><a class="header-anchor" href="#创建对齐时间序列" aria-hidden="true">#</a> 创建对齐时间序列</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">CREATE</span> ALIGNED TIMESERIES root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>GPS<span class="token punctuation">(</span>latitude <span class="token keyword">FLOAT</span> encoding<span class="token operator">=</span>PLAIN compressor<span class="token operator">=</span>SNAPPY<span class="token punctuation">,</span> longitude <span class="token keyword">FLOAT</span> encoding<span class="token operator">=</span>PLAIN compressor<span class="token operator">=</span>SNAPPY<span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="删除时间序列" tabindex="-1"><a class="header-anchor" href="#删除时间序列" aria-hidden="true">#</a> 删除时间序列</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">delete</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span><span class="token keyword">status</span>
<span class="token keyword">delete</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span>temperature<span class="token punctuation">,</span> root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span>hardware
<span class="token keyword">delete</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span><span class="token operator">*</span>
<span class="token keyword">drop</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span><span class="token operator">*</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="查看时间序列" tabindex="-1"><a class="header-anchor" href="#查看时间序列" aria-hidden="true">#</a> 查看时间序列</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">SHOW</span> TIMESERIES
<span class="token keyword">SHOW</span> TIMESERIES <span class="token operator">&lt;</span>Path<span class="token operator">&gt;</span>
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span>
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span>
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">limit</span> <span class="token number">10</span> <span class="token keyword">offset</span> <span class="token number">10</span>
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">where</span> timeseries <span class="token keyword">contains</span> <span class="token string">&#39;wf01.wt&#39;</span>
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">where</span> dataType<span class="token operator">=</span><span class="token keyword">FLOAT</span>
<span class="token keyword">SHOW</span> LATEST TIMESERIES
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="统计时间序列数量" tabindex="-1"><a class="header-anchor" href="#统计时间序列数量" aria-hidden="true">#</a> 统计时间序列数量</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code>COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span>
COUNT TIMESERIES root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span>
COUNT TIMESERIES root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span><span class="token operator">*</span><span class="token punctuation">.</span><span class="token keyword">status</span>
COUNT TIMESERIES root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span>wt01<span class="token punctuation">.</span><span class="token keyword">status</span>
COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">WHERE</span> TIMESERIES <span class="token keyword">contains</span> <span class="token string">&#39;sgcc&#39;</span>
COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">WHERE</span> DATATYPE <span class="token operator">=</span> INT64
COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">WHERE</span> TAGS<span class="token punctuation">(</span>unit<span class="token punctuation">)</span> <span class="token keyword">contains</span> <span class="token string">&#39;c&#39;</span>
COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">WHERE</span> TAGS<span class="token punctuation">(</span>unit<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token string">&#39;c&#39;</span>
COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">WHERE</span> TIMESERIES <span class="token keyword">contains</span> <span class="token string">&#39;sgcc&#39;</span> <span class="token keyword">group</span> <span class="token keyword">by</span> <span class="token keyword">level</span> <span class="token operator">=</span> <span class="token number">1</span>
COUNT TIMESERIES root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">LEVEL</span><span class="token operator">=</span><span class="token number">1</span>
COUNT TIMESERIES root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">LEVEL</span><span class="token operator">=</span><span class="token number">2</span>
COUNT TIMESERIES root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf01<span class="token punctuation">.</span><span class="token operator">*</span> <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">LEVEL</span><span class="token operator">=</span><span class="token number">2</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="标签点管理" tabindex="-1"><a class="header-anchor" href="#标签点管理" aria-hidden="true">#</a> 标签点管理</h3><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">create</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1<span class="token punctuation">(</span>temprature<span class="token punctuation">)</span> <span class="token keyword">with</span> datatype<span class="token operator">=</span><span class="token keyword">FLOAT</span><span class="token punctuation">,</span> encoding<span class="token operator">=</span>RLE<span class="token punctuation">,</span> compression<span class="token operator">=</span>SNAPPY tags<span class="token punctuation">(</span>tag1<span class="token operator">=</span>v1<span class="token punctuation">,</span> tag2<span class="token operator">=</span>v2<span class="token punctuation">)</span> attributes<span class="token punctuation">(</span>attr1<span class="token operator">=</span>v1<span class="token punctuation">,</span> attr2<span class="token operator">=</span>v2<span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>重命名标签或属性</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1 <span class="token keyword">RENAME</span> tag1 <span class="token keyword">TO</span> newTag1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>重新设置标签或属性的值</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1 <span class="token keyword">SET</span> newTag1<span class="token operator">=</span>newV1<span class="token punctuation">,</span> attr1<span class="token operator">=</span>newV1
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>删除已经存在的标签或属性</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1 <span class="token keyword">DROP</span> tag1<span class="token punctuation">,</span> tag2
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>添加新的标签</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1 <span class="token keyword">ADD</span> TAGS tag3<span class="token operator">=</span>v3<span class="token punctuation">,</span> tag4<span class="token operator">=</span>v4
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>添加新的属性</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1 <span class="token keyword">ADD</span> ATTRIBUTES attr3<span class="token operator">=</span>v3<span class="token punctuation">,</span> attr4<span class="token operator">=</span>v4
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>更新插入别名,标签和属性</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>turbine<span class="token punctuation">.</span>d1<span class="token punctuation">.</span>s1 UPSERT ALIAS<span class="token operator">=</span>newAlias TAGS<span class="token punctuation">(</span>tag2<span class="token operator">=</span>newV2<span class="token punctuation">,</span> tag3<span class="token operator">=</span>v3<span class="token punctuation">)</span> ATTRIBUTES<span class="token punctuation">(</span>attr3<span class="token operator">=</span>v3<span class="token punctuation">,</span> attr4<span class="token operator">=</span>v4<span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><ul><li>使用标签作为过滤条件查询时间序列</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">SHOW</span> TIMESERIES <span class="token punctuation">(</span><span class="token operator">&lt;</span><span class="token identifier"><span class="token punctuation">`</span>PathPattern<span class="token punctuation">`</span></span><span class="token operator">&gt;</span><span class="token punctuation">)</span>? timeseriesWhereClause
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>返回给定路径的下的所有满足条件的时间序列信息:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span>hardware <span class="token keyword">ADD</span> TAGS unit<span class="token operator">=</span>c
<span class="token keyword">ALTER</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span>wf02<span class="token punctuation">.</span>wt02<span class="token punctuation">.</span><span class="token keyword">status</span> <span class="token keyword">ADD</span> TAGS description<span class="token operator">=</span>test1
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">where</span> TAGS<span class="token punctuation">(</span>unit<span class="token punctuation">)</span><span class="token operator">=</span><span class="token string">&#39;c&#39;</span>
<span class="token keyword">show</span> timeseries root<span class="token punctuation">.</span>ln<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">where</span> TAGS<span class="token punctuation">(</span>description<span class="token punctuation">)</span> <span class="token keyword">contains</span> <span class="token string">&#39;test1&#39;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><ul><li>使用标签作为过滤条件统计时间序列数量</li></ul><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code>COUNT TIMESERIES <span class="token punctuation">(</span><span class="token operator">&lt;</span><span class="token identifier"><span class="token punctuation">`</span>PathPattern<span class="token punctuation">`</span></span><span class="token operator">&gt;</span><span class="token punctuation">)</span>? timeseriesWhereClause
COUNT TIMESERIES <span class="token punctuation">(</span><span class="token operator">&lt;</span><span class="token identifier"><span class="token punctuation">`</span>PathPattern<span class="token punctuation">`</span></span><span class="token operator">&gt;</span><span class="token punctuation">)</span>? timeseriesWhereClause <span class="token keyword">GROUP</span> <span class="token keyword">BY</span> <span class="token keyword">LEVEL</span><span class="token operator">=</span><span class="token operator">&lt;</span><span class="token keyword">INTEGER</span><span class="token operator">&gt;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div></div></div><p>返回给定路径的下的所有满足条件的时间序列的数量:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code>count timeseries
count timeseries root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">where</span> TAGS<span class="token punctuation">(</span>unit<span class="token punctuation">)</span><span class="token operator">=</span><span class="token string">&#39;c&#39;</span>
count timeseries root<span class="token punctuation">.</span><span class="token operator">*</span><span class="token operator">*</span> <span class="token keyword">where</span> TAGS<span class="token punctuation">(</span>unit<span class="token punctuation">)</span><span class="token operator">=</span><span class="token string">&#39;c&#39;</span> <span class="token keyword">group</span> <span class="token keyword">by</span> <span class="token keyword">level</span> <span class="token operator">=</span> <span class="token number">2</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>创建对齐时间序列:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">create</span> aligned timeseries root<span class="token punctuation">.</span>sg1<span class="token punctuation">.</span>d1<span class="token punctuation">(</span>s1 INT32 tags<span class="token punctuation">(</span>tag1<span class="token operator">=</span>v1<span class="token punctuation">,</span> tag2<span class="token operator">=</span>v2<span class="token punctuation">)</span> attributes<span class="token punctuation">(</span>attr1<span class="token operator">=</span>v1<span class="token punctuation">,</span> attr2<span class="token operator">=</span>v2<span class="token punctuation">)</span><span class="token punctuation">,</span> s2 <span class="token keyword">DOUBLE</span> tags<span class="token punctuation">(</span>tag3<span class="token operator">=</span>v3<span class="token punctuation">,</span> tag4<span class="token operator">=</span>v4<span class="token punctuation">)</span> attributes<span class="token punctuation">(</span>attr3<span class="token operator">=</span>v3<span class="token punctuation">,</span> attr4<span class="token operator">=</span>v4<span class="token punctuation">)</span><span class="token punctuation">)</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>支持查询:</p><div class="language-sql line-numbers-mode" data-ext="sql"><pre class="language-sql"><code><span class="token keyword">show</span> timeseries <span class="token keyword">where</span> TAGS<span class="token punctuation">(</span>tag1<span class="token punctuation">)</span><span class="token operator">=</span><span class="token string">&#39;v1&#39;</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h2 id="_3、时间序列路径管理" tabindex="-1"><a class="header-anchor" href="#_3、时间序列路径管理" aria-hidden="true">#</a> 3、时间序列路径管理</h2><h3 id="查看路径的所有子路径" tabindex="-1"><a class="header-anchor" href="#查看路径的所有子路径" aria-hidden="true">#</a> 查看路径的所有子路径</h3><p>SHOW CHILD PATHS pathPattern</p><ul><li>查询 root.ln 的下一层:show child paths root.ln</li><li>查询形如 root.xx.xx.xx 的路径:show child paths root.<em>.</em></li></ul><h3 id="查看路径的所有子节点" tabindex="-1"><a class="header-anchor" href="#查看路径的所有子节点" aria-hidden="true">#</a> 查看路径的所有子节点</h3><p>SHOW CHILD NODES pathPattern</p><ul><li>查询 root 的下一层:show child nodes root</li><li>查询 root.ln 的下一层 :show child nodes root.ln</li></ul><h3 id="查看设备" tabindex="-1"><a class="header-anchor" href="#查看设备" aria-hidden="true">#</a> 查看设备</h3><p>IoTDB&gt; show devices</p><p>IoTDB&gt; show devices root.ln.**</p><h4 id="查看设备及其-database-信息" tabindex="-1"><a class="header-anchor" href="#查看设备及其-database-信息" aria-hidden="true">#</a> 查看设备及其 database 信息</h4><p>IoTDB&gt; show devices with database</p><p>IoTDB&gt; show devices root.ln.** with database</p><h3 id="统计节点数" tabindex="-1"><a class="header-anchor" href="#统计节点数" aria-hidden="true">#</a> 统计节点数</h3><p>IoTDB &gt; COUNT NODES root.** LEVEL=2</p><p>IoTDB &gt; COUNT NODES root.ln.** LEVEL=2</p><p>IoTDB &gt; COUNT NODES root.ln.wf01.* LEVEL=3</p><p>IoTDB &gt; COUNT NODES root.**.temperature LEVEL=3</p><h3 id="统计设备数量" tabindex="-1"><a class="header-anchor" href="#统计设备数量" aria-hidden="true">#</a> 统计设备数量</h3><p>IoTDB&gt; show devices</p><p>IoTDB&gt; count devices</p><p>IoTDB&gt; count devices root.ln.**</p><h2 id="_4、设备模板管理" tabindex="-1"><a class="header-anchor" href="#_4、设备模板管理" aria-hidden="true">#</a> 4、设备模板管理</h2><figure><img src="https://alioss.timecho.com/docs/img/模板.png" alt="img" tabindex="0" loading="lazy"><figcaption>img</figcaption></figure><p>Create template(s1 int, s2 float) on <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></p><p>Create device root.sg.d1</p><figure><img src="https://alioss.timecho.com/docs/img/模板流程.png" alt="img" tabindex="0" loading="lazy"><figcaption>img</figcaption></figure><h3 id="创建元数据模板" tabindex="-1"><a class="header-anchor" href="#创建元数据模板" aria-hidden="true">#</a> 创建元数据模板</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>CREATE SCHEMA TEMPLATE &lt;templateName&gt; ALIGNED? &#39;(&#39; &lt;measurementId&gt; &lt;attributeClauses&gt; [&#39;,&#39; &lt;measurementId&gt; &lt;attributeClauses&gt;]+ &#39;)&#39;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>创建包含两个非对齐序列的元数据模板</p><p>IoTDB&gt; create schema template t1 (temperature FLOAT encoding=RLE, status BOOLEAN encoding=PLAIN compression=SNAPPY)</p><p>创建包含一组对齐序列的元数据模板</p><p>IoTDB&gt; create schema template t2 aligned (lat FLOAT encoding=Gorilla, lon FLOAT encoding=Gorilla)</p><h3 id="挂载元数据模板" tabindex="-1"><a class="header-anchor" href="#挂载元数据模板" aria-hidden="true">#</a> 挂载元数据模板</h3><p>IoTDB&gt; set SCHEMA TEMPLATE t1 to root.sg1</p><h3 id="激活元数据模板" tabindex="-1"><a class="header-anchor" href="#激活元数据模板" aria-hidden="true">#</a> 激活元数据模板</h3><p>IoTDB&gt; create timeseries using SCHEMA TEMPLATE on root.sg1.d1</p><p>IoTDB&gt; set SCHEMA TEMPLATE t1 to root.sg1.d1</p><p>IoTDB&gt; set SCHEMA TEMPLATE t2 to root.sg1.d2</p><p>IoTDB&gt; create timeseries using schema template on root.sg1.d1</p><p>IoTDB&gt; create timeseries using schema template on root.sg1.d2</p><h3 id="查看元数据模板" tabindex="-1"><a class="header-anchor" href="#查看元数据模板" aria-hidden="true">#</a> 查看元数据模板</h3><p>IoTDB&gt; show schema templates</p><ul><li>查看某个元数据模板下的物理量</li></ul><p>IoTDB&gt; show nodes in schema template t1</p><ul><li>查看挂载了某个元数据模板的路径</li></ul><p>IoTDB&gt; show paths set schema template t1</p><ul><li>查看使用了某个元数据模板的路径(即模板在该路径上已激活,序列已创建)</li></ul><p>IoTDB&gt; show paths using schema template t1</p><p>IoTDB&gt; show devices using schema template t1</p><h3 id="解除元数据模板" tabindex="-1"><a class="header-anchor" href="#解除元数据模板" aria-hidden="true">#</a> 解除元数据模板</h3><p>IoTDB&gt; delete timeseries of schema template t1 from root.sg1.d1</p><p>IoTDB&gt; deactivate schema template t1 from root.sg1.d1</p><p>批量处理</p><p>IoTDB&gt; delete timeseries of schema template t1 from root.sg1.<em>, root.sg2.</em></p><p>IoTDB&gt; deactivate schema template t1 from root.sg1.<em>, root.sg2.</em></p><h3 id="卸载元数据模板" tabindex="-1"><a class="header-anchor" href="#卸载元数据模板" aria-hidden="true">#</a> 卸载元数据模板</h3><p>IoTDB&gt; unset schema template t1 from root.sg1.d1</p><h3 id="删除元数据模板" tabindex="-1"><a class="header-anchor" href="#删除元数据模板" aria-hidden="true">#</a> 删除元数据模板</h3><p>IoTDB&gt; drop schema template t1</p><h2 id="_5、数据存活时间管理" tabindex="-1"><a class="header-anchor" href="#_5、数据存活时间管理" aria-hidden="true">#</a> 5、数据存活时间管理</h2><h3 id="设置-ttl" tabindex="-1"><a class="header-anchor" href="#设置-ttl" aria-hidden="true">#</a> 设置 TTL</h3><p>IoTDB&gt; set ttl to root.ln 3600000</p><p>IoTDB&gt; set ttl to root.sgcc.** 3600000</p><p>IoTDB&gt; set ttl to root.** 3600000</p><h3 id="取消-ttl" tabindex="-1"><a class="header-anchor" href="#取消-ttl" aria-hidden="true">#</a> 取消 TTL</h3><p>IoTDB&gt; unset ttl to root.ln</p><p>IoTDB&gt; unset ttl to root.sgcc.**</p><p>IoTDB&gt; unset ttl to root.**</p><h3 id="显示-ttl" tabindex="-1"><a class="header-anchor" href="#显示-ttl" aria-hidden="true">#</a> 显示 TTL</h3><p>IoTDB&gt; SHOW ALL TTL</p><p>IoTDB&gt; SHOW TTL ON StorageGroupNames</p><h1 id="写入数据" tabindex="-1"><a class="header-anchor" href="#写入数据" aria-hidden="true">#</a> 写入数据</h1><h2 id="_1、写入单列数据" tabindex="-1"><a class="header-anchor" href="#_1、写入单列数据" aria-hidden="true">#</a> 1、写入单列数据</h2><p>IoTDB &gt; insert into root.ln.wf02.wt02(timestamp,status) values(1,true)</p><p>IoTDB &gt; insert into root.ln.wf02.wt02(timestamp,hardware) values(1, &#39;v1&#39;),(2, &#39;v1&#39;)</p><h2 id="_2、写入多列数据" tabindex="-1"><a class="header-anchor" href="#_2、写入多列数据" aria-hidden="true">#</a> 2、写入多列数据</h2><p>IoTDB &gt; insert into root.ln.wf02.wt02(timestamp, status, hardware) values (2, false, &#39;v2&#39;)</p><p>IoTDB &gt; insert into root.ln.wf02.wt02(timestamp, status, hardware) VALUES (3, false, &#39;v3&#39;),(4, true, &#39;v4&#39;)</p><h2 id="_3、使用服务器时间戳" tabindex="-1"><a class="header-anchor" href="#_3、使用服务器时间戳" aria-hidden="true">#</a> 3、使用服务器时间戳</h2><p>IoTDB &gt; insert into root.ln.wf02.wt02(status, hardware) values (false, &#39;v2&#39;)</p><h2 id="_4、写入对齐时间序列数据" tabindex="-1"><a class="header-anchor" href="#_4、写入对齐时间序列数据" aria-hidden="true">#</a> 4、写入对齐时间序列数据</h2><p>IoTDB &gt; create aligned timeseries root.sg1.d1(s1 INT32, s2 DOUBLE)</p><p>IoTDB &gt; insert into root.sg1.d1(timestamp, s1, s2) aligned values(1, 1, 1)</p><p>IoTDB &gt; insert into root.sg1.d1(timestamp, s1, s2) aligned values(2, 2, 2), (3, 3, 3)</p><p>IoTDB &gt; select * from root.sg1.d1</p><h2 id="_5、加载-tsfile-文件数据" tabindex="-1"><a class="header-anchor" href="#_5、加载-tsfile-文件数据" aria-hidden="true">#</a> 5、加载 TsFile 文件数据</h2><p>load &#39;&lt;path/dir&gt;&#39; [sglevel=int][verify=true/false][onSuccess=delete/none]</p><h3 id="通过指定文件路径-绝对路径-加载单-tsfile-文件" tabindex="-1"><a class="header-anchor" href="#通过指定文件路径-绝对路径-加载单-tsfile-文件" aria-hidden="true">#</a> 通过指定文件路径(绝对路径)加载单 tsfile 文件</h3><ul><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39;</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; verify=true</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; verify=false</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; sglevel=1</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; onSuccess=delete</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; verify=true sglevel=1</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; verify=false sglevel=1</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; verify=true onSuccess=none</code></li><li><code>load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39; verify=false sglevel=1 onSuccess=delete</code></li></ul><h3 id="通过指定文件夹路径-绝对路径-批量加载文件" tabindex="-1"><a class="header-anchor" href="#通过指定文件夹路径-绝对路径-批量加载文件" aria-hidden="true">#</a> 通过指定文件夹路径(绝对路径)批量加载文件</h3><ul><li><code>load &#39;/Users/Desktop/data&#39;</code></li><li><code>load &#39;/Users/Desktop/data&#39; verify=false</code></li><li><code>load &#39;/Users/Desktop/data&#39; verify=true</code></li><li><code>load &#39;/Users/Desktop/data&#39; verify=true sglevel=1</code></li><li><code>load &#39;/Users/Desktop/data&#39; verify=false sglevel=1 onSuccess=delete</code></li></ul><h1 id="删除数据" tabindex="-1"><a class="header-anchor" href="#删除数据" aria-hidden="true">#</a> 删除数据</h1><h2 id="_1、删除单列数据" tabindex="-1"><a class="header-anchor" href="#_1、删除单列数据" aria-hidden="true">#</a> 1、删除单列数据</h2><p>delete from root.ln.wf02.wt02.status where time&lt;=2017-11-01T16:26:00;</p><p>delete from root.ln.wf02.wt02.status where time&gt;=2017-01-01T00:00:00 and time&lt;=2017-11-01T16:26:00;</p><p>delete from root.ln.wf02.wt02.status where time &lt; 10</p><p>delete from root.ln.wf02.wt02.status where time &lt;= 10</p><p>delete from root.ln.wf02.wt02.status where time &lt; 20 and time &gt; 10</p><p>delete from root.ln.wf02.wt02.status where time &lt;= 20 and time &gt;= 10</p><p>delete from root.ln.wf02.wt02.status where time &gt; 20</p><p>delete from root.ln.wf02.wt02.status where time &gt;= 20</p><p>delete from root.ln.wf02.wt02.status where time = 20</p><p>出错:</p><p>delete from root.ln.wf02.wt02.status where time &gt; 4 or time &lt; 0</p><p>Msg: 303: Check metadata error: For delete statement, where clause can only contain atomic</p><p>expressions like : time &gt; XXX, time &lt;= XXX, or two atomic expressions connected by &#39;AND&#39;</p><p>删除时间序列中的所有数据:</p><p>delete from root.ln.wf02.wt02.status</p><h2 id="_2、删除多列数据" tabindex="-1"><a class="header-anchor" href="#_2、删除多列数据" aria-hidden="true">#</a> 2、删除多列数据</h2><p>delete from root.ln.wf02.wt02.* where time &lt;= 2017-11-01T16:26:00;</p><p>声明式的编程方式:</p><p>IoTDB&gt; delete from root.ln.wf03.wt02.status where time &lt; now()</p><p>Msg: The statement is executed successfully.</p><h1 id="数据查询" tabindex="-1"><a class="header-anchor" href="#数据查询" aria-hidden="true">#</a> 数据查询</h1><h2 id="_1、基础查询" tabindex="-1"><a class="header-anchor" href="#_1、基础查询" aria-hidden="true">#</a> 1、基础查询</h2><h3 id="时间过滤查询" tabindex="-1"><a class="header-anchor" href="#时间过滤查询" aria-hidden="true">#</a> 时间过滤查询</h3><p>select temperature from root.ln.wf01.wt01 where time &lt; 2017-11-01T00:08:00.000</p><h3 id="根据一个时间区间选择多列数据" tabindex="-1"><a class="header-anchor" href="#根据一个时间区间选择多列数据" aria-hidden="true">#</a> 根据一个时间区间选择多列数据</h3><p>select status, temperature from root.ln.wf01.wt01 where time &gt; 2017-11-01T00:05:00.000 and time &lt; 2017-11-01T00:12:00.000;</p><h3 id="按照多个时间区间选择同一设备的多列数据" tabindex="-1"><a class="header-anchor" href="#按照多个时间区间选择同一设备的多列数据" aria-hidden="true">#</a> 按照多个时间区间选择同一设备的多列数据</h3><p>select status, temperature from root.ln.wf01.wt01 where (time &gt; 2017-11-01T00:05:00.000 and time &lt; 2017-11-01T00:12:00.000) or (time &gt;= 2017-11-01T16:35:00.000 and time &lt;= 2017-11-01T16:37:00.000);</p><h3 id="按照多个时间区间选择不同设备的多列数据" tabindex="-1"><a class="header-anchor" href="#按照多个时间区间选择不同设备的多列数据" aria-hidden="true">#</a> 按照多个时间区间选择不同设备的多列数据</h3><p>select wf01.wt01.status, wf02.wt02.hardware from root.ln where (time &gt; 2017-11-01T00:05:00.000 and time &lt; 2017-11-01T00:12:00.000) or (time &gt;= 2017-11-01T16:35:00.000 and time &lt;= 2017-11-01T16:37:00.000);</p><h3 id="根据时间降序返回结果集" tabindex="-1"><a class="header-anchor" href="#根据时间降序返回结果集" aria-hidden="true">#</a> 根据时间降序返回结果集</h3><p>select * from root.ln.** where time &gt; 1 order by time desc limit 10;</p><h2 id="_2、选择表达式" tabindex="-1"><a class="header-anchor" href="#_2、选择表达式" aria-hidden="true">#</a> 2、选择表达式</h2><h3 id="使用别名" tabindex="-1"><a class="header-anchor" href="#使用别名" aria-hidden="true">#</a> 使用别名</h3><p>select s1 as temperature, s2 as speed from root.ln.wf01.wt01;</p><h3 id="运算符" tabindex="-1"><a class="header-anchor" href="#运算符" aria-hidden="true">#</a> 运算符</h3><h3 id="函数" tabindex="-1"><a class="header-anchor" href="#函数" aria-hidden="true">#</a> 函数</h3><p>不支持:</p><p>select s1, count(s1) from root.sg.d1;</p><p>select sin(s1), count(s1) from root.sg.d1;</p><p>select s1, count(s1) from root.sg.d1 group by ([10,100),10ms);</p><h4 id="时间序列查询嵌套表达式" tabindex="-1"><a class="header-anchor" href="#时间序列查询嵌套表达式" aria-hidden="true">#</a> 时间序列查询嵌套表达式</h4><p>示例 1:</p><p>select a,</p><p>​ b,</p><p>​ ((a + 1) * 2 - 1) % 2 + 1.5,</p><p>​ sin(a + sin(a + sin(b))),</p><p>​ -(a + b) * (sin(a + b) * sin(a + b) + cos(a + b) * cos(a + b)) + 1</p><p>from root.sg1;</p><p>示例 2:</p><p>select (a + b) * 2 + sin(a) from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></p><p>示例 3:</p><p>select (a + *) / 2 from root.sg1</p><p>示例 4:</p><p>select (a + b) * 3 from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>, root.ln</p><h4 id="聚合查询嵌套表达式" tabindex="-1"><a class="header-anchor" href="#聚合查询嵌套表达式" aria-hidden="true">#</a> 聚合查询嵌套表达式</h4><p>示例 1:</p><p>select avg(temperature),</p><p>​ sin(avg(temperature)),</p><p>​ avg(temperature) + 1,</p><p>​ -sum(hardware),</p><p>​ avg(temperature) + sum(hardware)</p><p>from root.ln.wf01.wt01;</p><p>示例 2:</p><p>select avg(*),</p><p>​ (avg(*) + 1) * 3 / 2 -1</p><p>from root.sg1</p><p>示例 3:</p><p>select avg(temperature),</p><p>​ sin(avg(temperature)),</p><p>​ avg(temperature) + 1,</p><p>​ -sum(hardware),</p><p>​ avg(temperature) + sum(hardware) as custom_sum</p><p>from root.ln.wf01.wt01</p><p>GROUP BY([10, 90), 10ms);</p><h2 id="_3、最新点查询" tabindex="-1"><a class="header-anchor" href="#_3、最新点查询" aria-hidden="true">#</a> 3、最新点查询</h2><p>SQL 语法:</p><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>select last &lt;Path&gt; [COMMA &lt;Path&gt;]* from &lt; PrefixPath &gt; [COMMA &lt; PrefixPath &gt;]* &lt;whereClause&gt; [ORDER BY TIMESERIES (DESC | ASC)?]
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>查询 root.ln.wf01.wt01.status 的最新数据点</p><p>IoTDB&gt; select last status from root.ln.wf01.wt01</p><p>查询 root.ln.wf01.wt01 下 status,temperature 时间戳大于等于 2017-11-07T23:50:00 的最新数据点</p><p>IoTDB&gt; select last status, temperature from root.ln.wf01.wt01 where time &gt;= 2017-11-07T23:50:00</p><p>查询 root.ln.wf01.wt01 下所有序列的最新数据点,并按照序列名降序排列</p><p>IoTDB&gt; select last * from root.ln.wf01.wt01 order by timeseries desc;</p><h2 id="_4、查询对齐模式" tabindex="-1"><a class="header-anchor" href="#_4、查询对齐模式" aria-hidden="true">#</a> 4、查询对齐模式</h2><h3 id="按设备对齐" tabindex="-1"><a class="header-anchor" href="#按设备对齐" aria-hidden="true">#</a> 按设备对齐</h3><p>select * from root.ln.** where time &lt;= 2017-11-01T00:01:00 align by device;</p><h3 id="设备对齐模式下的排序" tabindex="-1"><a class="header-anchor" href="#设备对齐模式下的排序" aria-hidden="true">#</a> 设备对齐模式下的排序</h3><h4 id="时间对齐模式下的排序" tabindex="-1"><a class="header-anchor" href="#时间对齐模式下的排序" aria-hidden="true">#</a> 时间对齐模式下的排序</h4><p>select * from root.ln.** where time &lt;= 2017-11-01T00:01:00 order by time desc;</p><h4 id="设备对齐模式下的排序-1" tabindex="-1"><a class="header-anchor" href="#设备对齐模式下的排序-1" aria-hidden="true">#</a> 设备对齐模式下的排序</h4><p>select * from root.ln.** where time &lt;= 2017-11-01T00:01:00 order by device desc,time asc align by device;</p><p>在时间戳相等时按照设备名排序</p><p>select * from root.ln.** where time &lt;= 2017-11-01T00:01:00 order by time asc,device desc align by device;</p><p>没有显式指定时</p><p>select * from root.ln.** where time &lt;= 2017-11-01T00:01:00 align by device;</p><p>对聚合后的结果进行排序</p><p>select count(*) from root.ln.** group by ((2017-11-01T00:00:00.000+08:00,2017-11-01T00:03:00.000+08:00],1m) order by device asc,time asc align by device</p><h2 id="_5、查询过滤条件" tabindex="-1"><a class="header-anchor" href="#_5、查询过滤条件" aria-hidden="true">#</a> 5、查询过滤条件</h2><p>选择时间戳大于 2022-01-01T00:05:00.000 的数据:</p><p>select s1 from root.sg1.d1 where time &gt; 2022-01-01T00:05:00.000;</p><p>选择时间戳等于 2022-01-01T00:05:00.000 的数据:</p><p>select s1 from root.sg1.d1 where time = 2022-01-01T00:05:00.000;</p><p>选择时间区间 [2017-11-01T00:05:00.000, 2017-11-01T00:12:00.000) 内的数据:</p><p>select s1 from root.sg1.d1 where time &gt;= 2022-01-01T00:05:00.000 and time &lt; 2017-11-01T00:12:00.000;</p><h3 id="值过滤条件" tabindex="-1"><a class="header-anchor" href="#值过滤条件" aria-hidden="true">#</a> 值过滤条件</h3><p>选择值大于 36.5 的数据:</p><p>select temperature from root.sg1.d1 where temperature &gt; 36.5;</p><p>选择值等于 true 的数据:</p><p>select status from root.sg1.d1 where status = true;</p><p>选择区间 [36.5,40] 内或之外的数据:</p><p>select temperature from root.sg1.d1 where temperature between 36.5 and 40;</p><p>select temperature from root.sg1.d1 where temperature not between 36.5 and 40;</p><p>选择值在特定范围内的数据:</p><p>select code from root.sg1.d1 where code in (&#39;200&#39;, &#39;300&#39;, &#39;400&#39;, &#39;500&#39;);</p><p>选择值在特定范围外的数据:</p><p>select code from root.sg1.d1 where code not in (&#39;200&#39;, &#39;300&#39;, &#39;400&#39;, &#39;500&#39;);</p><p>选择值为空的数据:</p><p>select code from root.sg1.d1 where temperature is null;</p><p>选择值为非空的数据:</p><p>select code from root.sg1.d1 where temperature is not null;</p><h3 id="模糊查询" tabindex="-1"><a class="header-anchor" href="#模糊查询" aria-hidden="true">#</a> 模糊查询</h3><p>查询 <code>root.sg.d1</code><code>value</code> 含有<code>&#39;cc&#39;</code>的数据</p><p>IoTDB&gt; select * from root.sg.d1 where value like &#39;%cc%&#39;</p><p>查询 <code>root.sg.d1</code><code>value</code> 中间为 <code>&#39;b&#39;</code>、前后为任意单个字符的数据</p><p>IoTDB&gt; select * from root.sg.device where value like &#39;<em>b</em>&#39;</p><p>查询 root.sg.d1 下 value 值为26个英文字符组成的字符串</p><p>IoTDB&gt; select * from root.sg.d1 where value regexp &#39;<sup class="footnote-ref"><a href="#footnote1">[1]</a><a class="footnote-anchor" id="footnote-ref1"></a></sup>+$&#39;</p><p>查询 root.sg.d1 下 value 值为26个小写英文字符组成的字符串且时间大于100的</p><p>IoTDB&gt; select * from root.sg.d1 where value regexp &#39;<sup class="footnote-ref"><a href="#footnote2">[2]</a><a class="footnote-anchor" id="footnote-ref2"></a></sup>+$&#39; and time &gt; 100</p><h2 id="_6、分段分组聚合" tabindex="-1"><a class="header-anchor" href="#_6、分段分组聚合" aria-hidden="true">#</a> 6、分段分组聚合</h2><h4 id="未指定滑动步长的时间区间分组聚合查询" tabindex="-1"><a class="header-anchor" href="#未指定滑动步长的时间区间分组聚合查询" aria-hidden="true">#</a> 未指定滑动步长的时间区间分组聚合查询</h4><p>select count(status), max_value(temperature) from root.ln.wf01.wt01 group by ([2017-11-01T00:00:00, 2017-11-07T23:00:00),1d);</p><h4 id="指定滑动步长的时间区间分组聚合查询" tabindex="-1"><a class="header-anchor" href="#指定滑动步长的时间区间分组聚合查询" aria-hidden="true">#</a> 指定滑动步长的时间区间分组聚合查询</h4><p>select count(status), max_value(temperature) from root.ln.wf01.wt01 group by ([2017-11-01 00:00:00, 2017-11-07 23:00:00), 3h, 1d);</p><p>滑动步长可以小于聚合窗口</p><p>select count(status), max_value(temperature) from root.ln.wf01.wt01 group by ([2017-11-01 00:00:00, 2017-11-01 10:00:00), 4h, 2h);</p><h4 id="按照自然月份的时间区间分组聚合查询" tabindex="-1"><a class="header-anchor" href="#按照自然月份的时间区间分组聚合查询" aria-hidden="true">#</a> 按照自然月份的时间区间分组聚合查询</h4><p>select count(status) from root.ln.wf01.wt01 where time &gt; 2017-11-01T01:00:00 group by([2017-11-01T00:00:00, 2019-11-07T23:00:00), 1mo, 2mo);</p><p>每个时间间隔窗口内都有数据</p><p>select count(status) from root.ln.wf01.wt01 group by([2017-10-31T00:00:00, 2019-11-07T23:00:00), 1mo, 2mo);</p><h4 id="左开右闭区间" tabindex="-1"><a class="header-anchor" href="#左开右闭区间" aria-hidden="true">#</a> 左开右闭区间</h4><p>select count(status) from root.ln.wf01.wt01 group by ((2017-11-01T00:00:00, 2017-11-07T23:00:00],1d);</p><h4 id="与分组聚合混合使用" tabindex="-1"><a class="header-anchor" href="#与分组聚合混合使用" aria-hidden="true">#</a> 与分组聚合混合使用</h4><p>统计降采样后的数据点个数</p><p>select count(status) from root.ln.wf01.wt01 group by ((2017-11-01T00:00:00, 2017-11-07T23:00:00],1d), level=1;</p><p>加上滑动 Step 的降采样后的结果也可以汇总</p><p>select count(status) from root.ln.wf01.wt01 group by ([2017-11-01 00:00:00, 2017-11-07 23:00:00), 3h, 1d), level=1;</p><h3 id="路径层级分组聚合" tabindex="-1"><a class="header-anchor" href="#路径层级分组聚合" aria-hidden="true">#</a> 路径层级分组聚合</h3><p>统计不同 database 下 status 序列的数据点个数</p><p>select count(status) from root.** group by level = 1</p><p>统计不同设备下 status 序列的数据点个数</p><p>select count(status) from root.** group by level = 3</p><p>统计不同 database 下的不同设备中 status 序列的数据点个数</p><p>select count(status) from root.** group by level = 1, 3</p><p>查询所有序列下温度传感器 temperature 的最大值</p><p>select max_value(temperature) from root.** group by level = 0</p><p>查询某一层级下所有传感器拥有的总数据点数</p><p>select count(*) from root.ln.** group by level = 2</p><h3 id="标签分组聚合" tabindex="-1"><a class="header-anchor" href="#标签分组聚合" aria-hidden="true">#</a> 标签分组聚合</h3><h4 id="单标签聚合查询" tabindex="-1"><a class="header-anchor" href="#单标签聚合查询" aria-hidden="true">#</a> 单标签聚合查询</h4><p>SELECT AVG(temperature) FROM root.factory1.** GROUP BY TAGS(city);</p><h4 id="多标签聚合查询" tabindex="-1"><a class="header-anchor" href="#多标签聚合查询" aria-hidden="true">#</a> 多标签聚合查询</h4><p>SELECT avg(temperature) FROM root.factory1.** GROUP BY TAGS(city, workshop);</p><h4 id="基于时间区间的标签聚合查询" tabindex="-1"><a class="header-anchor" href="#基于时间区间的标签聚合查询" aria-hidden="true">#</a> 基于时间区间的标签聚合查询</h4><p>SELECT AVG(temperature) FROM root.factory1.** GROUP BY ([1000, 10000), 5s), TAGS(city, workshop);</p><h3 id="差值分段聚合" tabindex="-1"><a class="header-anchor" href="#差值分段聚合" aria-hidden="true">#</a> 差值分段聚合</h3><p>group by variation(controlExpression[,delta][,ignoreNull=true/false])</p><h4 id="delta-0时的等值事件分段" tabindex="-1"><a class="header-anchor" href="#delta-0时的等值事件分段" aria-hidden="true">#</a> delta=0时的等值事件分段</h4><p>select __endTime, avg(s1), count(s2), sum(s3) from root.sg.d group by variation(s6)</p><p>指定ignoreNull为false</p><p>select __endTime, avg(s1), count(s2), sum(s3) from root.sg.d group by variation(s6, ignoreNull=false)</p><h4 id="delta-0时的差值事件分段" tabindex="-1"><a class="header-anchor" href="#delta-0时的差值事件分段" aria-hidden="true">#</a> delta!=0时的差值事件分段</h4><p>select __endTime, avg(s1), count(s2), sum(s3) from root.sg.d group by variation(s6, 4)</p><h3 id="条件分段聚合" tabindex="-1"><a class="header-anchor" href="#条件分段聚合" aria-hidden="true">#</a> 条件分段聚合</h3><p>group by condition(predict,[keep&gt;/&gt;=/=/&lt;=/&lt;]threshold,[,ignoreNull=true/false])</p><p>查询至少连续两行以上的charging_status=1的数据</p><p>select max_time(charging_status),count(vehicle_status),last_value(soc) from root.** group by condition(charging_status=1,KEEP&gt;=2,ignoreNull=true)</p><p>当设置<code>ignoreNull</code>为false时,遇到null值为将其视为一个不满足条件的行,得到结果原先的分组被含null的行拆分</p><p>select max_time(charging_status),count(vehicle_status),last_value(soc) from root.** group by condition(charging_status=1,KEEP&gt;=2,ignoreNull=false)</p><h3 id="会话分段聚合" tabindex="-1"><a class="header-anchor" href="#会话分段聚合" aria-hidden="true">#</a> 会话分段聚合</h3><p>group by session(timeInterval)</p><p>按照不同的时间单位设定时间间隔</p><p>select __endTime,count(*) from root.** group by session(1d)</p><p><code>HAVING</code><code>ALIGN BY DEVICE</code>共同使用</p><p>select __endTime,sum(hardware) from root.ln.wf02.wt01 group by session(50s) having sum(hardware)&gt;0 align by device</p><h2 id="点数分段聚合" tabindex="-1"><a class="header-anchor" href="#点数分段聚合" aria-hidden="true">#</a> 点数分段聚合</h2><p>group by count(controlExpression, size[,ignoreNull=true/false])</p><p>select count(charging_stauts), first_value(soc) from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a> group by count(charging_status,5)</p><p>当使用ignoreNull将null值也考虑进来</p><p>select count(charging_stauts), first_value(soc) from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a> group by count(charging_status,5,ignoreNull=false)</p><h2 id="_7、聚合结果过滤" tabindex="-1"><a class="header-anchor" href="#_7、聚合结果过滤" aria-hidden="true">#</a> 7、聚合结果过滤</h2><p>不正确的:</p><p>select count(s1) from root.** group by ([1,3),1ms) having sum(s1) &gt; s1</p><p>select count(s1) from root.** group by ([1,3),1ms) having s1 &gt; 1</p><p>select count(s1) from root.** group by ([1,3),1ms), level=1 having sum(d1.s1) &gt; 1</p><p>select count(d1.s1) from root.** group by ([1,3),1ms), level=1 having sum(s1) &gt; 1</p><p>SQL 示例:</p><p>select count(s1) from root.** group by ([1,11),2ms), level=1 having count(s2) &gt; 2;</p><p>select count(s1), count(s2) from root.** group by ([1,11),2ms) having count(s2) &gt; 1 align by device;</p><h2 id="_8、结果集补空值" tabindex="-1"><a class="header-anchor" href="#_8、结果集补空值" aria-hidden="true">#</a> 8、结果集补空值</h2><p>FILL &#39;(&#39; PREVIOUS | LINEAR | constant &#39;)&#39;</p><h4 id="previous-填充" tabindex="-1"><a class="header-anchor" href="#previous-填充" aria-hidden="true">#</a> <code>PREVIOUS</code> 填充</h4><p>select temperature, status from root.sgcc.wf03.wt01 where time &gt;= 2017-11-01T16:37:00.000 and time &lt;= 2017-11-01T16:40:00.000 fill(previous);</p><h4 id="linear-填充" tabindex="-1"><a class="header-anchor" href="#linear-填充" aria-hidden="true">#</a> <code>LINEAR</code> 填充</h4><p>select temperature, status from root.sgcc.wf03.wt01 where time &gt;= 2017-11-01T16:37:00.000 and time &lt;= 2017-11-01T16:40:00.000 fill(linear);</p><h4 id="常量填充" tabindex="-1"><a class="header-anchor" href="#常量填充" aria-hidden="true">#</a> 常量填充</h4><p>select temperature, status from root.sgcc.wf03.wt01 where time &gt;= 2017-11-01T16:37:00.000 and time &lt;= 2017-11-01T16:40:00.000 fill(2.0);</p><p>使用 <code>BOOLEAN</code> 类型的常量填充</p><p>select temperature, status from root.sgcc.wf03.wt01 where time &gt;= 2017-11-01T16:37:00.000 and time &lt;= 2017-11-01T16:40:00.000 fill(true);</p><h2 id="_9、查询结果分页" tabindex="-1"><a class="header-anchor" href="#_9、查询结果分页" aria-hidden="true">#</a> 9、查询结果分页</h2><h3 id="按行分页" tabindex="-1"><a class="header-anchor" href="#按行分页" aria-hidden="true">#</a> 按行分页</h3><p>基本的 <code>LIMIT</code> 子句</p><p>select status, temperature from root.ln.wf01.wt01 limit 10</p><p><code>OFFSET</code><code>LIMIT</code> 子句</p><p>select status, temperature from root.ln.wf01.wt01 limit 5 offset 3</p><p><code>LIMIT</code> 子句与 <code>WHERE</code> 子句结合</p><p>select status,temperature from root.ln.wf01.wt01 where time &gt; 2017-11-01T00:05:00.000 and time&lt; 2017-11-01T00:12:00.000 limit 5 offset 3</p><p><code>LIMIT</code> 子句与 <code>GROUP BY</code> 子句组合</p><p>select count(status), max_value(temperature) from root.ln.wf01.wt01 group by ([2017-11-01T00:00:00, 2017-11-07T23:00:00),1d) limit 4 offset 3</p><h3 id="按列分页" tabindex="-1"><a class="header-anchor" href="#按列分页" aria-hidden="true">#</a> 按列分页</h3><p>基本的 <code>SLIMIT</code> 子句</p><p>select * from root.ln.wf01.wt01 where time &gt; 2017-11-01T00:05:00.000 and time &lt; 2017-11-01T00:12:00.000 slimit 1</p><p><code>SOFFSET</code><code>SLIMIT</code> 子句</p><p>select * from root.ln.wf01.wt01 where time &gt; 2017-11-01T00:05:00.000 and time &lt; 2017-11-01T00:12:00.000 slimit 1 soffset 1</p><p><code>SLIMIT</code> 子句与 <code>GROUP BY</code> 子句结合</p><p>select max_value(*) from root.ln.wf01.wt01 group by ([2017-11-01T00:00:00, 2017-11-07T23:00:00),1d) slimit 1 soffset 1</p><p><code>SLIMIT</code> 子句与 <code>LIMIT</code> 子句结合</p><p>select * from root.ln.wf01.wt01 limit 10 offset 100 slimit 2 soffset 0</p><h2 id="_10、查询写回-select-into" tabindex="-1"><a class="header-anchor" href="#_10、查询写回-select-into" aria-hidden="true">#</a> 10、查询写回(SELECT INTO)</h2><h4 id="整体描述" tabindex="-1"><a class="header-anchor" href="#整体描述" aria-hidden="true">#</a> 整体描述</h4><p>selectIntoStatement</p><p>​ : SELECT</p><p>​ resultColumn [, resultColumn] ...</p><p>​ INTO intoItem [, intoItem] ...</p><p>​ FROM prefixPath [, prefixPath] ...</p><p>​ [WHERE whereCondition]</p><p>​ [GROUP BY groupByTimeClause, groupByLevelClause]</p><p>​ [FILL {PREVIOUS | LINEAR | constant}]</p><p>​ [LIMIT rowLimit OFFSET rowOffset]</p><p>​ [ALIGN BY DEVICE]</p><p>​ ;</p><p>intoItem</p><p>​ : [ALIGNED] intoDevicePath &#39;(&#39; intoMeasurementName [&#39;,&#39; intoMeasurementName]* &#39;)&#39;</p><p>​ ;</p><p>按时间对齐,将 <code>root.sg</code> database 下四条序列的查询结果写入到 <code>root.sg_copy</code> database 下指定的四条序列中</p><p>IoTDB&gt; select s1, s2 into root.sg_copy.d1(t1), root.sg_copy.d2(t1, t2), root.sg_copy.d1(t2) from root.sg.d1, root.sg.d2;</p><p>按时间对齐,将聚合查询的结果存储到指定序列中</p><p>IoTDB&gt; select count(s1 + s2), last_value(s2) into root.agg.count(s1_add_s2), root.agg.last_value(s2) from root.sg.d1 group by ([0, 100), 10ms);</p><p>按设备对齐</p><p>IoTDB&gt; select s1, s2 into root.sg_copy.d1(t1, t2), root.sg_copy.d2(t1, t2) from root.sg.d1, root.sg.d2 align by device;</p><p>按设备对齐,将表达式计算的结果存储到指定序列中</p><p>IoTDB&gt; select s1 + s2 into root.expr.add(d1s1_d1s2), root.expr.add(d2s1_d2s2) from root.sg.d1, root.sg.d2 align by device;</p><h4 id="使用变量占位符" tabindex="-1"><a class="header-anchor" href="#使用变量占位符" aria-hidden="true">#</a> 使用变量占位符</h4><h5 id="按时间对齐-默认" tabindex="-1"><a class="header-anchor" href="#按时间对齐-默认" aria-hidden="true">#</a> 按时间对齐(默认)</h5><h6 id="_1-目标设备不使用变量占位符-目标物理量列表使用变量占位符" tabindex="-1"><a class="header-anchor" href="#_1-目标设备不使用变量占位符-目标物理量列表使用变量占位符" aria-hidden="true">#</a> (1)目标设备不使用变量占位符 &amp; 目标物理量列表使用变量占位符</h6><p>select s1, s2</p><p>into root.sg_copy.d1(:😃, root.sg_copy.d2(s1), root.sg_copy.d1(${3}), root.sg_copy.d2(:😃</p><p>from root.sg.d1, root.sg.d2;</p><p>该语句等价于:</p><p>select s1, s2</p><p>into root.sg_copy.d1(s1), root.sg_copy.d2(s1), root.sg_copy.d1(s2), root.sg_copy.d2(s2)</p><p>from root.sg.d1, root.sg.d2;</p><h6 id="_2-目标设备使用变量占位符-目标物理量列表不使用变量占位符" tabindex="-1"><a class="header-anchor" href="#_2-目标设备使用变量占位符-目标物理量列表不使用变量占位符" aria-hidden="true">#</a> (2)目标设备使用变量占位符 &amp; 目标物理量列表不使用变量占位符</h6><p>select d1.s1, d1.s2, d2.s3, d3.s4</p><p>into ::(s1_1, s2_2), root.sg.d2_2(s3_3), root.${2}_copy.::(s4)</p><p>from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>;</p><h6 id="_3-目标设备使用变量占位符-目标物理量列表使用变量占位符" tabindex="-1"><a class="header-anchor" href="#_3-目标设备使用变量占位符-目标物理量列表使用变量占位符" aria-hidden="true">#</a> (3)目标设备使用变量占位符 &amp; 目标物理量列表使用变量占位符</h6><p>select * into root.sg_bk.:😦:😃 from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>.**;</p><h5 id="按设备对齐-使用-align-by-device" tabindex="-1"><a class="header-anchor" href="#按设备对齐-使用-align-by-device" aria-hidden="true">#</a> 按设备对齐(使用 <code>ALIGN BY DEVICE</code></h5><h6 id="_1-目标设备不使用变量占位符-目标物理量列表使用变量占位符-1" tabindex="-1"><a class="header-anchor" href="#_1-目标设备不使用变量占位符-目标物理量列表使用变量占位符-1" aria-hidden="true">#</a> (1)目标设备不使用变量占位符 &amp; 目标物理量列表使用变量占位符</h6><p>select s1, s2, s3, s4</p><p>into root.backup_sg.d1(s1, s2, s3, s4), root.backup_sg.d2(:😃, root.sg.d3(backup_${4})</p><p>from root.sg.d1, root.sg.d2, root.sg.d3</p><p>align by device;</p><h6 id="_2-目标设备使用变量占位符-目标物理量列表不使用变量占位符-1" tabindex="-1"><a class="header-anchor" href="#_2-目标设备使用变量占位符-目标物理量列表不使用变量占位符-1" aria-hidden="true">#</a> (2)目标设备使用变量占位符 &amp; 目标物理量列表不使用变量占位符</h6><p>select avg(s1), sum(s2) + sum(s3), count(s4)</p><p>into root.agg_${2}.::(avg_s1, sum_s2_add_s3, count_s4)</p><p>from root.**</p><p>align by device;</p><h6 id="_3-目标设备使用变量占位符-目标物理量列表使用变量占位符-1" tabindex="-1"><a class="header-anchor" href="#_3-目标设备使用变量占位符-目标物理量列表使用变量占位符-1" aria-hidden="true">#</a> (3)目标设备使用变量占位符 &amp; 目标物理量列表使用变量占位符</h6><p>select * into ::(backup_${4}) from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>.** align by device;</p><h4 id="指定目标序列为对齐序列" tabindex="-1"><a class="header-anchor" href="#指定目标序列为对齐序列" aria-hidden="true">#</a> 指定目标序列为对齐序列</h4><p>select s1, s2 into root.sg_copy.d1(t1, t2), aligned root.sg_copy.d2(t1, t2) from root.sg.d1, root.sg.d2 align by device;</p><h2 id="_11、连续查询-continuous-query-cq" tabindex="-1"><a class="header-anchor" href="#_11、连续查询-continuous-query-cq" aria-hidden="true">#</a> 11、连续查询(Continuous Query, CQ)</h2><h3 id="语法" tabindex="-1"><a class="header-anchor" href="#语法" aria-hidden="true">#</a> 语法</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>CREATE (CONTINUOUS QUERY | CQ) &lt;cq_id&gt;
[RESAMPLE
[EVERY &lt;every_interval&gt;]
[BOUNDARY &lt;execution_boundary_time&gt;]
[RANGE &lt;start_time_offset&gt;[, end_time_offset]]
]
[TIMEOUT POLICY BLOCKED|DISCARD]
BEGIN
SELECT CLAUSE
INTO CLAUSE
FROM CLAUSE
[WHERE CLAUSE]
[GROUP BY(&lt;group_by_interval&gt;[, &lt;sliding_step&gt;]) [, level = &lt;level&gt;]]
[HAVING CLAUSE]
[FILL {PREVIOUS | LINEAR | constant}]
[LIMIT rowLimit OFFSET rowOffset]
[ALIGN BY DEVICE]
END
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h4 id="配置连续查询执行的周期性间隔" tabindex="-1"><a class="header-anchor" href="#配置连续查询执行的周期性间隔" aria-hidden="true">#</a> 配置连续查询执行的周期性间隔</h4><p>CREATE CONTINUOUS QUERY cq1</p><p>RESAMPLE EVERY 20s</p><p>BEGIN</p><p>SELECT max_value(temperature)</p><p>INTO root.ln.wf02.wt02(temperature_max), root.ln.wf02.wt01(temperature_max), root.ln.wf01.wt02(temperature_max), root.ln.wf01.wt01(temperature_max)</p><p>FROM root.ln.<em>.</em></p><p>GROUP BY(10s)</p><p>END</p><p>&gt; SELECT temperature_max from root.ln.<em>.</em>;</p><h4 id="配置连续查询的时间窗口大小" tabindex="-1"><a class="header-anchor" href="#配置连续查询的时间窗口大小" aria-hidden="true">#</a> 配置连续查询的时间窗口大小</h4><p>CREATE CONTINUOUS QUERY cq2</p><p>RESAMPLE RANGE 40s</p><p>BEGIN</p><p>SELECT max_value(temperature)</p><p>INTO root.ln.wf02.wt02(temperature_max), root.ln.wf02.wt01(temperature_max), root.ln.wf01.wt02(temperature_max), root.ln.wf01.wt01(temperature_max)</p><p>FROM root.ln.<em>.</em></p><p>GROUP BY(10s)</p><p>END</p><p>&gt; SELECT temperature_max from root.ln.<em>.</em>;</p><h4 id="同时配置连续查询执行的周期性间隔和时间窗口大小" tabindex="-1"><a class="header-anchor" href="#同时配置连续查询执行的周期性间隔和时间窗口大小" aria-hidden="true">#</a> 同时配置连续查询执行的周期性间隔和时间窗口大小</h4><p>CREATE CONTINUOUS QUERY cq3</p><p>RESAMPLE EVERY 20s RANGE 40s</p><p>BEGIN</p><p>SELECT max_value(temperature)</p><p>INTO root.ln.wf02.wt02(temperature_max), root.ln.wf02.wt01(temperature_max), root.ln.wf01.wt02(temperature_max), root.ln.wf01.wt01(temperature_max)</p><p>FROM root.ln.<em>.</em></p><p>GROUP BY(10s)</p><p>FILL(100.0)</p><p>END</p><p>&gt; SELECT temperature_max from root.ln.<em>.</em>;</p><h4 id="配置连续查询每次查询执行时间窗口的结束时间" tabindex="-1"><a class="header-anchor" href="#配置连续查询每次查询执行时间窗口的结束时间" aria-hidden="true">#</a> 配置连续查询每次查询执行时间窗口的结束时间</h4><p>CREATE CONTINUOUS QUERY cq4</p><p>RESAMPLE EVERY 20s RANGE 40s, 20s</p><p>BEGIN</p><p>SELECT max_value(temperature)</p><p>INTO root.ln.wf02.wt02(temperature_max), root.ln.wf02.wt01(temperature_max), root.ln.wf01.wt02(temperature_max), root.ln.wf01.wt01(temperature_max)</p><p>FROM root.ln.<em>.</em></p><p>GROUP BY(10s)</p><p>FILL(100.0)</p><p>END</p><p>&gt; SELECT temperature_max from root.ln.<em>.</em>;</p><h4 id="没有group-by-time子句的连续查询" tabindex="-1"><a class="header-anchor" href="#没有group-by-time子句的连续查询" aria-hidden="true">#</a> 没有GROUP BY TIME子句的连续查询</h4><p>CREATE CONTINUOUS QUERY cq5</p><p>RESAMPLE EVERY 20s</p><p>BEGIN</p><p>SELECT temperature + 1</p><p>INTO root.precalculated_sg.::(temperature)</p><p>FROM root.ln.<em>.</em></p><p>align by device</p><p>END</p><p>&gt; SELECT temperature from root.precalculated_sg.<em>.</em> align by device;</p><h3 id="连续查询的管理" tabindex="-1"><a class="header-anchor" href="#连续查询的管理" aria-hidden="true">#</a> 连续查询的管理</h3><h4 id="查询系统已有的连续查询" tabindex="-1"><a class="header-anchor" href="#查询系统已有的连续查询" aria-hidden="true">#</a> 查询系统已有的连续查询</h4><p>展示集群中所有的已注册的连续查询</p><p>SHOW (CONTINUOUS QUERIES | CQS)</p><p>SHOW CONTINUOUS QUERIES;</p><h4 id="删除已有的连续查询" tabindex="-1"><a class="header-anchor" href="#删除已有的连续查询" aria-hidden="true">#</a> 删除已有的连续查询</h4><p>删除指定的名为cq_id的连续查询:</p><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>DROP (CONTINUOUS QUERY | CQ) &lt;cq_id&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>DROP CONTINUOUS QUERY s1_count_cq;</p><h4 id="作为子查询的替代品" tabindex="-1"><a class="header-anchor" href="#作为子查询的替代品" aria-hidden="true">#</a> 作为子查询的替代品</h4><p>\1. 创建一个连续查询</p><p>CREATE CQ s1_count_cq</p><p>BEGIN</p><p>​ SELECT count(s1)</p><p>​ INTO root.sg_count.d.count_s1</p><p>​ FROM root.sg.d</p><p>​ GROUP BY(30m)</p><p>END</p><ol><li>查询连续查询的结果</li></ol><p>SELECT avg(count_s1) from root.sg_count.d;</p><h1 id="运算符和函数" tabindex="-1"><a class="header-anchor" href="#运算符和函数" aria-hidden="true">#</a> 运算符和函数</h1><h2 id="_1、用户自定义函数" tabindex="-1"><a class="header-anchor" href="#_1、用户自定义函数" aria-hidden="true">#</a> 1、用户自定义函数</h2><h5 id="udfparameters" tabindex="-1"><a class="header-anchor" href="#udfparameters" aria-hidden="true">#</a> UDFParameters</h5><p>SELECT UDF(s1, s2, &#39;key1&#39;=&#39;iotdb&#39;, &#39;key2&#39;=&#39;123.45&#39;) FROM root.sg.d;</p><h3 id="udf-注册" tabindex="-1"><a class="header-anchor" href="#udf-注册" aria-hidden="true">#</a> UDF 注册</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>CREATE FUNCTION &lt;UDF-NAME&gt; AS &lt;UDF-CLASS-FULL-PATHNAME&gt; (USING URI URI-STRING)?
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h5 id="不指定uri" tabindex="-1"><a class="header-anchor" href="#不指定uri" aria-hidden="true">#</a> 不指定URI</h5><p>CREATE FUNCTION example AS &#39;org.apache.iotdb.udf.UDTFExample&#39;</p><h5 id="指定uri" tabindex="-1"><a class="header-anchor" href="#指定uri" aria-hidden="true">#</a> 指定URI</h5><p>CREATE FUNCTION example AS &#39;org.apache.iotdb.udf.UDTFExample&#39; USING URI &#39;<a href="http://jar/example.jar" target="_blank" rel="noopener noreferrer">http://jar/example.jar<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>&#39;</p><h3 id="udf-卸载" tabindex="-1"><a class="header-anchor" href="#udf-卸载" aria-hidden="true">#</a> UDF 卸载</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>DROP FUNCTION &lt;UDF-NAME&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>DROP FUNCTION example</p><h3 id="udf-查询" tabindex="-1"><a class="header-anchor" href="#udf-查询" aria-hidden="true">#</a> UDF 查询</h3><h4 id="带自定义输入参数的查询" tabindex="-1"><a class="header-anchor" href="#带自定义输入参数的查询" aria-hidden="true">#</a> 带自定义输入参数的查询</h4><p>SELECT example(s1, &#39;key1&#39;=&#39;value1&#39;, &#39;key2&#39;=&#39;value2&#39;), example(*, &#39;key3&#39;=&#39;value3&#39;) FROM root.sg.d1;</p><p>SELECT example(s1, s2, &#39;key1&#39;=&#39;value1&#39;, &#39;key2&#39;=&#39;value2&#39;) FROM root.sg.d1;</p><h4 id="与其他查询的嵌套查询" tabindex="-1"><a class="header-anchor" href="#与其他查询的嵌套查询" aria-hidden="true">#</a> 与其他查询的嵌套查询</h4><p>SELECT s1, s2, example(s1, s2) FROM root.sg.d1;</p><p>SELECT <em>, example(</em>) FROM root.sg.d1 DISABLE ALIGN;</p><p>SELECT s1 * example(* / s1 + s2) FROM root.sg.d1;</p><p>SELECT s1, s2, s1 + example(s1, s2), s1 - example(s1 + example(s1, s2) / s2) FROM root.sg.d1;</p><h3 id="查看所有注册的-udf" tabindex="-1"><a class="header-anchor" href="#查看所有注册的-udf" aria-hidden="true">#</a> 查看所有注册的 UDF</h3><p>SHOW FUNCTIONS</p><h2 id="_2、聚合函数" tabindex="-1"><a class="header-anchor" href="#_2、聚合函数" aria-hidden="true">#</a> 2、聚合函数</h2><h3 id="count-if" tabindex="-1"><a class="header-anchor" href="#count-if" aria-hidden="true">#</a> COUNT_IF</h3><p>语法</p><p>count_if(predicate, [keep &gt;=/&gt;/=/!=/&lt;/&lt;=]threshold[, &#39;ignoreNull&#39;=&#39;true/false&#39;])</p><h5 id="不使用ignorenull参数-忽略null" tabindex="-1"><a class="header-anchor" href="#不使用ignorenull参数-忽略null" aria-hidden="true">#</a> 不使用ignoreNull参数(忽略null)</h5><p>select count_if(s1=0 &amp; s2=0, 3), count_if(s1=1 &amp; s2=0, 3) from root.db.d1</p><h5 id="使用ignorenull参数" tabindex="-1"><a class="header-anchor" href="#使用ignorenull参数" aria-hidden="true">#</a> 使用ignoreNull参数</h5><p>select count_if(s1=0 &amp; s2=0, 3, &#39;ignoreNull&#39;=&#39;false&#39;), count_if(s1=1 &amp; s2=0, 3, &#39;ignoreNull&#39;=&#39;false&#39;) from root.db.d1</p><h2 id="time-duration" tabindex="-1"><a class="header-anchor" href="#time-duration" aria-hidden="true">#</a> TIME_DURATION</h2><p>语法</p><p>​ time_duration(Path)</p><p>示例</p><p>select time_duration(s1) from root.db.d1</p><h2 id="_3、算数运算符和函数" tabindex="-1"><a class="header-anchor" href="#_3、算数运算符和函数" aria-hidden="true">#</a> 3、算数运算符和函数</h2><h3 id="算数运算符" tabindex="-1"><a class="header-anchor" href="#算数运算符" aria-hidden="true">#</a> 算数运算符</h3><p>select s1, - s1, s2, + s2, s1 + s2, s1 - s2, s1 * s2, s1 / s2, s1 % s2 from root.sg.d1</p><h3 id="数学函数" tabindex="-1"><a class="header-anchor" href="#数学函数" aria-hidden="true">#</a> 数学函数</h3><p>select s1, sin(s1), cos(s1), tan(s1) from root.sg1.d1 limit 5 offset 1000;</p><h4 id="round" tabindex="-1"><a class="header-anchor" href="#round" aria-hidden="true">#</a> ROUND</h4><p>select s4,round(s4),round(s4,2),round(s4,-1) from root.sg1.d1</p><h2 id="_4、比较运算符和函数" tabindex="-1"><a class="header-anchor" href="#_4、比较运算符和函数" aria-hidden="true">#</a> 4、比较运算符和函数</h2><h3 id="基本比较运算符" tabindex="-1"><a class="header-anchor" href="#基本比较运算符" aria-hidden="true">#</a> 基本比较运算符</h3><p>select a, b, a &gt; 10, a &lt;= b, !(a &lt;= b), a &gt; 10 &amp;&amp; a &gt; b from root.test;</p><h3 id="between-and-运算符" tabindex="-1"><a class="header-anchor" href="#between-and-运算符" aria-hidden="true">#</a> <code>BETWEEN ... AND ...</code> 运算符</h3><p>select temperature from root.sg1.d1 where temperature between 36.5 and 40;</p><p>select temperature from root.sg1.d1 where temperature not between 36.5 and 40;</p><h3 id="模糊匹配运算符" tabindex="-1"><a class="header-anchor" href="#模糊匹配运算符" aria-hidden="true">#</a> 模糊匹配运算符</h3><p>查询 <code>root.sg.d1</code><code>value</code> 含有<code>&#39;cc&#39;</code>的数据</p><p>select * from root.sg.d1 where value like &#39;%cc%&#39;</p><p>查询 <code>root.sg.d1</code><code>value</code> 中间为 <code>&#39;b&#39;</code>、前后为任意单个字符的数据</p><p>select * from root.sg.device where value like &#39;<em>b</em>&#39;</p><h4 id="使用-regexp-进行模糊匹配" tabindex="-1"><a class="header-anchor" href="#使用-regexp-进行模糊匹配" aria-hidden="true">#</a> 使用 <code>Regexp</code> 进行模糊匹配</h4><p>查询 root.sg.d1 下 value 值为26个英文字符组成的字符串</p><p>select * from root.sg.d1 where value regexp &#39;<sup class="footnote-ref"><a href="#footnote3">[3]</a><a class="footnote-anchor" id="footnote-ref3"></a></sup>+$&#39;</p><p>查询 root.sg.d1 下 value 值为26个小写英文字符组成的字符串且时间大于100的</p><p>select * from root.sg.d1 where value regexp &#39;<sup class="footnote-ref"><a href="#footnote4">[4]</a><a class="footnote-anchor" id="footnote-ref4"></a></sup>+$&#39; and time &gt; 100</p><p>select b, b like &#39;1%&#39;, b regexp &#39;[0-2]&#39; from root.test</p><p><code>IS NULL</code> 运算符</p><p>选择值为空的数据:</p><p>select code from root.sg1.d1 where temperature is null;</p><p>选择值为非空的数据:</p><p>select code from root.sg1.d1 where temperature is not null;</p><p><code>IN</code> 运算符</p><p>选择值在特定范围内的数据:</p><p>select code from root.sg1.d1 where code in (&#39;200&#39;, &#39;300&#39;, &#39;400&#39;, &#39;500&#39;);</p><p>选择值在特定范围外的数据:</p><p>select code from root.sg1.d1 where code not in (&#39;200&#39;, &#39;300&#39;, &#39;400&#39;, &#39;500&#39;);</p><p>select a, a in (1, 2) from root.test;</p><h3 id="条件函数" tabindex="-1"><a class="header-anchor" href="#条件函数" aria-hidden="true">#</a> 条件函数</h3><p>select ts, on_off(ts, &#39;threshold&#39;=&#39;2&#39;) from root.test;</p><p>select ts, in_range(ts, &#39;lower&#39;=&#39;2&#39;, &#39;upper&#39;=&#39;3.1&#39;) from root.test;</p><h2 id="_5、逻辑运算符" tabindex="-1"><a class="header-anchor" href="#_5、逻辑运算符" aria-hidden="true">#</a> 5、逻辑运算符</h2><p>select a, b, a &gt; 10, a &lt;= b, !(a &lt;= b), a &gt; 10 &amp;&amp; a &gt; b from root.test;</p><h2 id="_6、字符串处理" tabindex="-1"><a class="header-anchor" href="#_6、字符串处理" aria-hidden="true">#</a> 6、字符串处理</h2><h3 id="string-contains" tabindex="-1"><a class="header-anchor" href="#string-contains" aria-hidden="true">#</a> STRING_CONTAINS</h3><p>select s1, string_contains(s1, &#39;s&#39;=&#39;warn&#39;) from root.sg1.d4;</p><h3 id="string-matches" tabindex="-1"><a class="header-anchor" href="#string-matches" aria-hidden="true">#</a> STRING_MATCHES</h3><p>select s1, string_matches(s1, &#39;regex&#39;=&#39;[^\s]+37229&#39;) from root.sg1.d4;</p><h3 id="length" tabindex="-1"><a class="header-anchor" href="#length" aria-hidden="true">#</a> Length</h3><p>select s1, length(s1) from root.sg1.d1</p><h3 id="locate" tabindex="-1"><a class="header-anchor" href="#locate" aria-hidden="true">#</a> Locate</h3><p>select s1, locate(s1, &quot;target&quot;=&quot;1&quot;) from root.sg1.d1</p><p>select s1, locate(s1, &quot;target&quot;=&quot;1&quot;, &quot;reverse&quot;=&quot;true&quot;) from root.sg1.d1</p><h3 id="startswith" tabindex="-1"><a class="header-anchor" href="#startswith" aria-hidden="true">#</a> StartsWith</h3><p>select s1, startswith(s1, &quot;target&quot;=&quot;1&quot;) from root.sg1.d1</p><h3 id="endswith" tabindex="-1"><a class="header-anchor" href="#endswith" aria-hidden="true">#</a> EndsWith</h3><p>select s1, endswith(s1, &quot;target&quot;=&quot;1&quot;) from root.sg1.d1</p><h3 id="concat" tabindex="-1"><a class="header-anchor" href="#concat" aria-hidden="true">#</a> Concat</h3><p>select s1, s2, concat(s1, s2, &quot;target1&quot;=&quot;IoT&quot;, &quot;target2&quot;=&quot;DB&quot;) from root.sg1.d1</p><p>select s1, s2, concat(s1, s2, &quot;target1&quot;=&quot;IoT&quot;, &quot;target2&quot;=&quot;DB&quot;, &quot;series_behind&quot;=&quot;true&quot;) from root.sg1.d1</p><h3 id="substring" tabindex="-1"><a class="header-anchor" href="#substring" aria-hidden="true">#</a> Substring</h3><p>select s1, substring(s1 from 1 for 2) from root.sg1.d1</p><h3 id="replace" tabindex="-1"><a class="header-anchor" href="#replace" aria-hidden="true">#</a> Replace</h3><p>select s1, replace(s1, &#39;es&#39;, &#39;tt&#39;) from root.sg1.d1</p><h3 id="upper" tabindex="-1"><a class="header-anchor" href="#upper" aria-hidden="true">#</a> Upper</h3><p>select s1, upper(s1) from root.sg1.d1</p><h3 id="lower" tabindex="-1"><a class="header-anchor" href="#lower" aria-hidden="true">#</a> Lower</h3><p>select s1, lower(s1) from root.sg1.d1</p><h3 id="trim" tabindex="-1"><a class="header-anchor" href="#trim" aria-hidden="true">#</a> Trim</h3><p>select s3, trim(s3) from root.sg1.d1</p><h3 id="strcmp" tabindex="-1"><a class="header-anchor" href="#strcmp" aria-hidden="true">#</a> StrCmp</h3><p>select s1, s2, strcmp(s1, s2) from root.sg1.d1</p><h3 id="strreplace" tabindex="-1"><a class="header-anchor" href="#strreplace" aria-hidden="true">#</a> StrReplace</h3><p>select strreplace(s1, &quot;target&quot;=&quot;,&quot;, &quot;replace&quot;=&quot;/&quot;, &quot;limit&quot;=&quot;2&quot;) from root.test.d1</p><p>select strreplace(s1, &quot;target&quot;=&quot;,&quot;, &quot;replace&quot;=&quot;/&quot;, &quot;limit&quot;=&quot;1&quot;, &quot;offset&quot;=&quot;1&quot;, &quot;reverse&quot;=&quot;true&quot;) from root.test.d1</p><h3 id="regexmatch" tabindex="-1"><a class="header-anchor" href="#regexmatch" aria-hidden="true">#</a> RegexMatch</h3><p>select regexmatch(s1, &quot;regex&quot;=&quot;\d+.\d+.\d+.\d+&quot;, &quot;group&quot;=&quot;0&quot;) from root.test.d1</p><h3 id="regexreplace" tabindex="-1"><a class="header-anchor" href="#regexreplace" aria-hidden="true">#</a> RegexReplace</h3><p>select regexreplace(s1, &quot;regex&quot;=&quot;192.168.0.(\d+)&quot;, &quot;replace&quot;=&quot;cluster-$1&quot;, &quot;limit&quot;=&quot;1&quot;) from root.test.d1</p><h3 id="regexsplit" tabindex="-1"><a class="header-anchor" href="#regexsplit" aria-hidden="true">#</a> RegexSplit</h3><p>select regexsplit(s1, &quot;regex&quot;=&quot;,&quot;, &quot;index&quot;=&quot;-1&quot;) from root.test.d1</p><p>select regexsplit(s1, &quot;regex&quot;=&quot;,&quot;, &quot;index&quot;=&quot;3&quot;) from root.test.d1</p><h2 id="_7、数据类型转换" tabindex="-1"><a class="header-anchor" href="#_7、数据类型转换" aria-hidden="true">#</a> 7、数据类型转换</h2><h3 id="cast" tabindex="-1"><a class="header-anchor" href="#cast" aria-hidden="true">#</a> CAST</h3><p>SELECT cast(s1 as INT32) from <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></p><h4 id="使用示例" tabindex="-1"><a class="header-anchor" href="#使用示例" aria-hidden="true">#</a> 使用示例</h4><p>cast BOOLEAN to other types</p><p>select cast(s5 as INT32), cast(s5 as INT64),cast(s5 as FLOAT),cast(s5 as DOUBLE), cast(s5 as TEXT) from root.sg.d1</p><p>cast TEXT to numeric types</p><p>select cast(s6 as INT32), cast(s6 as INT64), cast(s6 as FLOAT), cast(s6 as DOUBLE) from root.sg.d1 where time &lt; 2</p><p>cast TEXT to BOOLEAN</p><p>select cast(s6 as BOOLEAN) from root.sg.d1 where time &gt;= 2</p><h2 id="_8、常序列生成函数" tabindex="-1"><a class="header-anchor" href="#_8、常序列生成函数" aria-hidden="true">#</a> 8、常序列生成函数</h2><p>select s1, s2, const(s1, &#39;value&#39;=&#39;1024&#39;, &#39;type&#39;=&#39;INT64&#39;), pi(s2), e(s1, s2) from root.sg1.d1;</p><h2 id="_9、选择函数" tabindex="-1"><a class="header-anchor" href="#_9、选择函数" aria-hidden="true">#</a> 9、选择函数</h2><p>select s1, top_k(s1, &#39;k&#39;=&#39;2&#39;), bottom_k(s1, &#39;k&#39;=&#39;2&#39;) from root.sg1.d2 where time &gt; 2020-12-10T20:36:15.530+08:00;</p><h2 id="_10、区间查询函数" tabindex="-1"><a class="header-anchor" href="#_10、区间查询函数" aria-hidden="true">#</a> 10、区间查询函数</h2><p>select s1, zero_count(s1), non_zero_count(s2), zero_duration(s3), non_zero_duration(s4) from root.sg.d2;</p><h2 id="_11、趋势计算函数" tabindex="-1"><a class="header-anchor" href="#_11、趋势计算函数" aria-hidden="true">#</a> 11、趋势计算函数</h2><p>select s1, time_difference(s1), difference(s1), non_negative_difference(s1), derivative(s1), non_negative_derivative(s1) from root.sg1.d1 limit 5 offset 1000;</p><h5 id="不使用ignorenull参数-忽略null-1" tabindex="-1"><a class="header-anchor" href="#不使用ignorenull参数-忽略null-1" aria-hidden="true">#</a> 不使用ignoreNull参数(忽略null)</h5><p>SELECT DIFF(s1), DIFF(s2) from root.test;</p><h5 id="使用ignorenull参数-1" tabindex="-1"><a class="header-anchor" href="#使用ignorenull参数-1" aria-hidden="true">#</a> 使用ignoreNull参数</h5><p>SELECT DIFF(s1, &#39;ignoreNull&#39;=&#39;false&#39;), DIFF(s2, &#39;ignoreNull&#39;=&#39;false&#39;) from root.test;</p><h2 id="_12、采样函数" tabindex="-1"><a class="header-anchor" href="#_12、采样函数" aria-hidden="true">#</a> 12、采样函数</h2><h3 id="等数量分桶随机采样" tabindex="-1"><a class="header-anchor" href="#等数量分桶随机采样" aria-hidden="true">#</a> 等数量分桶随机采样</h3><p>select equal_size_bucket_random_sample(temperature,&#39;proportion&#39;=&#39;0.1&#39;) as random_sample from root.ln.wf01.wt01;</p><h3 id="等数量分桶聚合采样" tabindex="-1"><a class="header-anchor" href="#等数量分桶聚合采样" aria-hidden="true">#</a> 等数量分桶聚合采样</h3><p>select equal_size_bucket_agg_sample(temperature, &#39;type&#39;=&#39;avg&#39;,&#39;proportion&#39;=&#39;0.1&#39;) as agg_avg, equal_size_bucket_agg_sample(temperature, &#39;type&#39;=&#39;max&#39;,&#39;proportion&#39;=&#39;0.1&#39;) as agg_max, equal_size_bucket_agg_sample(temperature,&#39;type&#39;=&#39;min&#39;,&#39;proportion&#39;=&#39;0.1&#39;) as agg_min, equal_size_bucket_agg_sample(temperature, &#39;type&#39;=&#39;sum&#39;,&#39;proportion&#39;=&#39;0.1&#39;) as agg_sum, equal_size_bucket_agg_sample(temperature, &#39;type&#39;=&#39;extreme&#39;,&#39;proportion&#39;=&#39;0.1&#39;) as agg_extreme, equal_size_bucket_agg_sample(temperature, &#39;type&#39;=&#39;variance&#39;,&#39;proportion&#39;=&#39;0.1&#39;) as agg_variance from root.ln.wf01.wt01;</p><h3 id="等数量分桶-m4-采样" tabindex="-1"><a class="header-anchor" href="#等数量分桶-m4-采样" aria-hidden="true">#</a> 等数量分桶 M4 采样</h3><p>select equal_size_bucket_m4_sample(temperature, &#39;proportion&#39;=&#39;0.1&#39;) as M4_sample from root.ln.wf01.wt01;</p><h3 id="等数量分桶离群值采样" tabindex="-1"><a class="header-anchor" href="#等数量分桶离群值采样" aria-hidden="true">#</a> 等数量分桶离群值采样</h3><p>select equal_size_bucket_outlier_sample(temperature, &#39;proportion&#39;=&#39;0.1&#39;, &#39;type&#39;=&#39;avg&#39;, &#39;number&#39;=&#39;2&#39;) as outlier_avg_sample, equal_size_bucket_outlier_sample(temperature, &#39;proportion&#39;=&#39;0.1&#39;, &#39;type&#39;=&#39;stendis&#39;, &#39;number&#39;=&#39;2&#39;) as outlier_stendis_sample, equal_size_bucket_outlier_sample(temperature, &#39;proportion&#39;=&#39;0.1&#39;, &#39;type&#39;=&#39;cos&#39;, &#39;number&#39;=&#39;2&#39;) as outlier_cos_sample, equal_size_bucket_outlier_sample(temperature, &#39;proportion&#39;=&#39;0.1&#39;, &#39;type&#39;=&#39;prenextdis&#39;, &#39;number&#39;=&#39;2&#39;) as outlier_prenextdis_sample from root.ln.wf01.wt01;</p><h2 id="m4函数" tabindex="-1"><a class="header-anchor" href="#m4函数" aria-hidden="true">#</a> M4函数</h2><p>查询语句1:</p><p>select M4(s1,&#39;timeInterval&#39;=&#39;25&#39;,&#39;displayWindowBegin&#39;=&#39;0&#39;,&#39;displayWindowEnd&#39;=&#39;100&#39;) from root.vehicle.d1</p><p>查询语句2:</p><p>select M4(s1,&#39;windowSize&#39;=&#39;10&#39;) from root.vehicle.d1</p><p>使用Grafana的<a href="https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#global-variables" target="_blank" rel="noopener noreferrer">模板变量<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a></p><p>select M4(s1,&#39;timeInterval&#39;=&#39;$__interval_ms&#39;) from root.sg1.d1</p><h2 id="_13、时间序列处理" tabindex="-1"><a class="header-anchor" href="#_13、时间序列处理" aria-hidden="true">#</a> 13、时间序列处理</h2><h3 id="change-points" tabindex="-1"><a class="header-anchor" href="#change-points" aria-hidden="true">#</a> CHANGE_POINTS</h3><p>select change_points(s1), change_points(s2), change_points(s3), change_points(s4), change_points(s5), change_points(s6) from root.testChangePoints.d1</p><h2 id="_14、lambda-表达式" tabindex="-1"><a class="header-anchor" href="#_14、lambda-表达式" aria-hidden="true">#</a> 14、Lambda 表达式</h2><h3 id="jexl-自定义函数" tabindex="-1"><a class="header-anchor" href="#jexl-自定义函数" aria-hidden="true">#</a> JEXL 自定义函数</h3><p>select jexl(temperature, &#39;expr&#39;=&#39;x -&gt; {x + x}&#39;) as jexl1, jexl(temperature, &#39;expr&#39;=&#39;x -&gt; {x * 3}&#39;) as jexl2, jexl(temperature, &#39;expr&#39;=&#39;x -&gt; {x * x}&#39;) as jexl3, jexl(temperature, &#39;expr&#39;=&#39;x -&gt; {multiply(x, 100)}&#39;) as jexl4, jexl(temperature, st, &#39;expr&#39;=&#39;(x, y) -&gt; {x + y}&#39;) as jexl5, jexl(temperature, st, str, &#39;expr&#39;=&#39;(x, y, z) -&gt; {x + y + z}&#39;) as jexl6 from root.ln.wf01.wt01;</p><h2 id="_15、条件表达式" tabindex="-1"><a class="header-anchor" href="#_15、条件表达式" aria-hidden="true">#</a> 15、条件表达式</h2><h3 id="case" tabindex="-1"><a class="header-anchor" href="#case" aria-hidden="true">#</a> CASE</h3><h4 id="语法示例" tabindex="-1"><a class="header-anchor" href="#语法示例" aria-hidden="true">#</a> 语法示例</h4><ul><li><p>格式1:</p><p>CASE</p></li></ul><p>​ WHEN condition1 THEN expression1</p><p>​ [WHEN condition2 THEN expression2] ...</p><p>​ [ELSE expression_end]</p><p>END</p><ul><li><p>格式2:</p><p>CASE caseValue</p></li></ul><p>​ WHEN whenValue1 THEN expression1</p><p>​ [WHEN whenValue2 THEN expression2] ...</p><p>​ [ELSE expression_end]</p><p>END</p><h5 id="示例1" tabindex="-1"><a class="header-anchor" href="#示例1" aria-hidden="true">#</a> 示例1</h5><p>select T, P, case</p><p>when 1000&lt;T and T&lt;1050 and 1000000&lt;P and P&lt;1100000 then &quot;good!&quot;</p><p>when T&lt;=1000 or T&gt;=1050 then &quot;bad temperature&quot;</p><p>when P&lt;=1000000 or P&gt;=1100000 then &quot;bad pressure&quot;</p><p>end as <code>result</code></p><p>from root.test1</p><h5 id="示例2" tabindex="-1"><a class="header-anchor" href="#示例2" aria-hidden="true">#</a> 示例2</h5><p>select str, case</p><p>when str like &quot;%cc%&quot; then &quot;has cc&quot;</p><p>when str like &quot;%dd%&quot; then &quot;has dd&quot;</p><p>else &quot;no cc and dd&quot; end as <code>result</code></p><p>from root.test2</p><h5 id="示例3-搭配聚合函数" tabindex="-1"><a class="header-anchor" href="#示例3-搭配聚合函数" aria-hidden="true">#</a> 示例3:搭配聚合函数</h5><p>select</p><p>count(case when x&lt;=1 then 1 end) as <code>(-∞,1]</code>,</p><p>count(case when 1&lt;x and x&lt;=3 then 1 end) as <code>(1,3]</code>,</p><p>count(case when 3&lt;x and x&lt;=7 then 1 end) as <code>(3,7]</code>,</p><p>count(case when 7&lt;x then 1 end) as <code>(7,+∞)</code></p><p>from root.test3</p><h6 id="非法-case表达式←聚合函数" tabindex="-1"><a class="header-anchor" href="#非法-case表达式←聚合函数" aria-hidden="true">#</a> 非法:CASE表达式←聚合函数</h6><p>select case when x&lt;=1 then avg(x) else sum(x) end from root.test3</p><h5 id="示例4-格式2" tabindex="-1"><a class="header-anchor" href="#示例4-格式2" aria-hidden="true">#</a> 示例4:格式2</h5><p>select x, case x when 1 then &quot;one&quot; when 2 then &quot;two&quot; else &quot;other&quot; end from root.test4</p><h5 id="示例5-结果子句类型" tabindex="-1"><a class="header-anchor" href="#示例5-结果子句类型" aria-hidden="true">#</a> 示例5:结果子句类型</h5><h6 id="非法-boolean与其它类型共存" tabindex="-1"><a class="header-anchor" href="#非法-boolean与其它类型共存" aria-hidden="true">#</a> 非法:BOOLEAN与其它类型共存</h6><p>select x, case x when 1 then true when 2 then 2 end from root.test4</p><h6 id="合法-只存在boolean类型" tabindex="-1"><a class="header-anchor" href="#合法-只存在boolean类型" aria-hidden="true">#</a> 合法:只存在BOOLEAN类型</h6><p>select x, case x when 1 then true when 2 then false end as <code>result</code> from root.test4</p><h6 id="非法-text与其它类型共存" tabindex="-1"><a class="header-anchor" href="#非法-text与其它类型共存" aria-hidden="true">#</a> 非法:TEXT与其它类型共存</h6><p>select x, case x when 1 then 1 when 2 then &quot;str&quot; end from root.test4</p><h6 id="合法-数值类型共存" tabindex="-1"><a class="header-anchor" href="#合法-数值类型共存" aria-hidden="true">#</a> 合法:数值类型共存</h6><p>select x, case x</p><p>when 1 then 1</p><p>when 2 then 222222222222222</p><p>when 3 then 3.3</p><p>when 4 then 4.4444444444444</p><p>end as <code>result</code></p><p>from root.test4</p><h2 id="_16、数据画像" tabindex="-1"><a class="header-anchor" href="#_16、数据画像" aria-hidden="true">#</a> 16、数据画像</h2><h3 id="acf" tabindex="-1"><a class="header-anchor" href="#acf" aria-hidden="true">#</a> ACF</h3><p>select acf(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:05</p><h3 id="distinct" tabindex="-1"><a class="header-anchor" href="#distinct" aria-hidden="true">#</a> Distinct</h3><p>select distinct(s2) from root.test.d2</p><h3 id="histogram" tabindex="-1"><a class="header-anchor" href="#histogram" aria-hidden="true">#</a> Histogram</h3><p>select histogram(s1,&quot;min&quot;=&quot;1&quot;,&quot;max&quot;=&quot;20&quot;,&quot;count&quot;=&quot;10&quot;) from root.test.d1</p><h3 id="integral" tabindex="-1"><a class="header-anchor" href="#integral" aria-hidden="true">#</a> Integral</h3><p>select integral(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:10</p><h4 id="指定时间单位" tabindex="-1"><a class="header-anchor" href="#指定时间单位" aria-hidden="true">#</a> 指定时间单位</h4><p>select integral(s1, &quot;unit&quot;=&quot;1m&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:00:10</p><h3 id="integralavg" tabindex="-1"><a class="header-anchor" href="#integralavg" aria-hidden="true">#</a> IntegralAvg</h3><p>select integralavg(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:10</p><h3 id="mad" tabindex="-1"><a class="header-anchor" href="#mad" aria-hidden="true">#</a> Mad</h3><p>select mad(s0) from root.test</p><h5 id="近似查询" tabindex="-1"><a class="header-anchor" href="#近似查询" aria-hidden="true">#</a> 近似查询</h5><p>select mad(s0, &quot;error&quot;=&quot;0.01&quot;) from root.test</p><h3 id="median" tabindex="-1"><a class="header-anchor" href="#median" aria-hidden="true">#</a> Median</h3><p>select median(s0, &quot;error&quot;=&quot;0.01&quot;) from root.test</p><h3 id="minmax" tabindex="-1"><a class="header-anchor" href="#minmax" aria-hidden="true">#</a> MinMax</h3><p>select minmax(s1) from root.test</p><h3 id="mode" tabindex="-1"><a class="header-anchor" href="#mode" aria-hidden="true">#</a> Mode</h3><p>select mode(s2) from root.test.d2</p><h3 id="mvavg" tabindex="-1"><a class="header-anchor" href="#mvavg" aria-hidden="true">#</a> MvAvg</h3><p>select mvavg(s1, &quot;window&quot;=&quot;3&quot;) from root.test</p><h3 id="pacf" tabindex="-1"><a class="header-anchor" href="#pacf" aria-hidden="true">#</a> PACF</h3><p>select pacf(s1, &quot;lag&quot;=&quot;5&quot;) from root.test</p><h3 id="percentile" tabindex="-1"><a class="header-anchor" href="#percentile" aria-hidden="true">#</a> Percentile</h3><p>select percentile(s0, &quot;rank&quot;=&quot;0.2&quot;, &quot;error&quot;=&quot;0.01&quot;) from root.test</p><h3 id="quantile" tabindex="-1"><a class="header-anchor" href="#quantile" aria-hidden="true">#</a> Quantile</h3><p>select quantile(s0, &quot;rank&quot;=&quot;0.2&quot;, &quot;K&quot;=&quot;800&quot;) from root.test</p><h3 id="period" tabindex="-1"><a class="header-anchor" href="#period" aria-hidden="true">#</a> Period</h3><p>select period(s1) from root.test.d3</p><h3 id="qlb" tabindex="-1"><a class="header-anchor" href="#qlb" aria-hidden="true">#</a> QLB</h3><p>select QLB(s1) from root.test.d1</p><h3 id="resample" tabindex="-1"><a class="header-anchor" href="#resample" aria-hidden="true">#</a> Resample</h3><h5 id="上采样" tabindex="-1"><a class="header-anchor" href="#上采样" aria-hidden="true">#</a> 上采样</h5><p>select resample(s1,&#39;every&#39;=&#39;5m&#39;,&#39;interp&#39;=&#39;linear&#39;) from root.test.d1</p><h5 id="下采样" tabindex="-1"><a class="header-anchor" href="#下采样" aria-hidden="true">#</a> 下采样</h5><p>select resample(s1,&#39;every&#39;=&#39;30m&#39;,&#39;aggr&#39;=&#39;first&#39;) from root.test.d1</p><h5 id="指定重采样时间段" tabindex="-1"><a class="header-anchor" href="#指定重采样时间段" aria-hidden="true">#</a> 指定重采样时间段</h5><p>select resample(s1,&#39;every&#39;=&#39;30m&#39;,&#39;start&#39;=&#39;2021-03-06 15:00:00&#39;) from root.test.d1</p><h3 id="sample" tabindex="-1"><a class="header-anchor" href="#sample" aria-hidden="true">#</a> Sample</h3><h5 id="蓄水池采样" tabindex="-1"><a class="header-anchor" href="#蓄水池采样" aria-hidden="true">#</a> 蓄水池采样</h5><p>select sample(s1,&#39;method&#39;=&#39;reservoir&#39;,&#39;k&#39;=&#39;5&#39;) from root.test.d1</p><h5 id="等距采样" tabindex="-1"><a class="header-anchor" href="#等距采样" aria-hidden="true">#</a> 等距采样</h5><p>select sample(s1,&#39;method&#39;=&#39;isometric&#39;,&#39;k&#39;=&#39;5&#39;) from root.test.d1</p><h3 id="segment" tabindex="-1"><a class="header-anchor" href="#segment" aria-hidden="true">#</a> Segment</h3><p>select segment(s1,&quot;error&quot;=&quot;0.1&quot;) from root.test</p><h3 id="skew" tabindex="-1"><a class="header-anchor" href="#skew" aria-hidden="true">#</a> Skew</h3><p>select skew(s1) from root.test.d1</p><h3 id="spline" tabindex="-1"><a class="header-anchor" href="#spline" aria-hidden="true">#</a> Spline</h3><p>select spline(s1, &quot;points&quot;=&quot;151&quot;) from root.test</p><h3 id="spread" tabindex="-1"><a class="header-anchor" href="#spread" aria-hidden="true">#</a> Spread</h3><p>select spread(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h3 id="stddev" tabindex="-1"><a class="header-anchor" href="#stddev" aria-hidden="true">#</a> Stddev</h3><p>select stddev(s1) from root.test.d1</p><h3 id="zscore" tabindex="-1"><a class="header-anchor" href="#zscore" aria-hidden="true">#</a> ZScore</h3><p>select zscore(s1) from root.test</p><h2 id="_17、异常检测" tabindex="-1"><a class="header-anchor" href="#_17、异常检测" aria-hidden="true">#</a> 17、异常检测</h2><h3 id="iqr" tabindex="-1"><a class="header-anchor" href="#iqr" aria-hidden="true">#</a> IQR</h3><p>select iqr(s1) from root.test</p><h3 id="ksigma" tabindex="-1"><a class="header-anchor" href="#ksigma" aria-hidden="true">#</a> KSigma</h3><p>select ksigma(s1,&quot;k&quot;=&quot;1.0&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h3 id="lof" tabindex="-1"><a class="header-anchor" href="#lof" aria-hidden="true">#</a> LOF</h3><p>select lof(s1,s2) from root.test.d1 where time&lt;1000</p><h5 id="诊断一维时间序列" tabindex="-1"><a class="header-anchor" href="#诊断一维时间序列" aria-hidden="true">#</a> 诊断一维时间序列</h5><p>select lof(s1, &quot;method&quot;=&quot;series&quot;) from root.test.d1 where time&lt;1000</p><h3 id="missdetect" tabindex="-1"><a class="header-anchor" href="#missdetect" aria-hidden="true">#</a> MissDetect</h3><p>select missdetect(s2,&#39;minlen&#39;=&#39;10&#39;) from root.test.d2</p><h3 id="range" tabindex="-1"><a class="header-anchor" href="#range" aria-hidden="true">#</a> Range</h3><p>select range(s1,&quot;lower_bound&quot;=&quot;101.0&quot;,&quot;upper_bound&quot;=&quot;125.0&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h3 id="twosidedfilter" tabindex="-1"><a class="header-anchor" href="#twosidedfilter" aria-hidden="true">#</a> TwoSidedFilter</h3><p>select TwoSidedFilter(s0, &#39;len&#39;=&#39;5&#39;, &#39;threshold&#39;=&#39;0.3&#39;) from root.test</p><h3 id="outlier" tabindex="-1"><a class="header-anchor" href="#outlier" aria-hidden="true">#</a> Outlier</h3><p>select outlier(s1,&quot;r&quot;=&quot;5.0&quot;,&quot;k&quot;=&quot;4&quot;,&quot;w&quot;=&quot;10&quot;,&quot;s&quot;=&quot;5&quot;) from root.test</p><h2 id="_18、数据匹配" tabindex="-1"><a class="header-anchor" href="#_18、数据匹配" aria-hidden="true">#</a> 18、数据匹配</h2><h3 id="cov" tabindex="-1"><a class="header-anchor" href="#cov" aria-hidden="true">#</a> Cov</h3><p>select cov(s1,s2) from root.test.d2</p><h3 id="dtw" tabindex="-1"><a class="header-anchor" href="#dtw" aria-hidden="true">#</a> Dtw</h3><p>select dtw(s1,s2) from root.test.d2</p><h3 id="pearson" tabindex="-1"><a class="header-anchor" href="#pearson" aria-hidden="true">#</a> Pearson</h3><p>select pearson(s1,s2) from root.test.d2</p><h3 id="ptnsym" tabindex="-1"><a class="header-anchor" href="#ptnsym" aria-hidden="true">#</a> PtnSym</h3><p>select ptnsym(s4, &#39;window&#39;=&#39;5&#39;, &#39;threshold&#39;=&#39;0&#39;) from root.test.d1</p><h3 id="xcorr" tabindex="-1"><a class="header-anchor" href="#xcorr" aria-hidden="true">#</a> XCorr</h3><p>select xcorr(s1, s2) from root.test.d1 where time &lt;= 2020-01-01 00:00:05</p><h2 id="_19、频域分析" tabindex="-1"><a class="header-anchor" href="#_19、频域分析" aria-hidden="true">#</a> 19、频域分析</h2><h3 id="conv" tabindex="-1"><a class="header-anchor" href="#conv" aria-hidden="true">#</a> Conv</h3><p>select conv(s1,s2) from root.test.d2</p><h3 id="deconv" tabindex="-1"><a class="header-anchor" href="#deconv" aria-hidden="true">#</a> Deconv</h3><h5 id="计算去卷积的商" tabindex="-1"><a class="header-anchor" href="#计算去卷积的商" aria-hidden="true">#</a> 计算去卷积的商</h5><p>select deconv(s3,s2) from root.test.d2</p><h5 id="计算去卷积的余数" tabindex="-1"><a class="header-anchor" href="#计算去卷积的余数" aria-hidden="true">#</a> 计算去卷积的余数</h5><p>select deconv(s3,s2,&#39;result&#39;=&#39;remainder&#39;) from root.test.d2</p><h3 id="dwt" tabindex="-1"><a class="header-anchor" href="#dwt" aria-hidden="true">#</a> DWT</h3><p>select dwt(s1,&quot;method&quot;=&quot;haar&quot;) from root.test.d1</p><h3 id="fft" tabindex="-1"><a class="header-anchor" href="#fft" aria-hidden="true">#</a> FFT</h3><h5 id="等距傅里叶变换" tabindex="-1"><a class="header-anchor" href="#等距傅里叶变换" aria-hidden="true">#</a> 等距傅里叶变换</h5><p>select fft(s1) from root.test.d1</p><h5 id="等距傅里叶变换并压缩" tabindex="-1"><a class="header-anchor" href="#等距傅里叶变换并压缩" aria-hidden="true">#</a> 等距傅里叶变换并压缩</h5><p>select fft(s1, &#39;result&#39;=&#39;real&#39;, &#39;compress&#39;=&#39;0.99&#39;), fft(s1, &#39;result&#39;=&#39;imag&#39;,&#39;compress&#39;=&#39;0.99&#39;) from root.test.d1</p><h3 id="highpass" tabindex="-1"><a class="header-anchor" href="#highpass" aria-hidden="true">#</a> HighPass</h3><p>select highpass(s1,&#39;wpass&#39;=&#39;0.45&#39;) from root.test.d1</p><h3 id="ifft" tabindex="-1"><a class="header-anchor" href="#ifft" aria-hidden="true">#</a> IFFT</h3><p>select ifft(re, im, &#39;interval&#39;=&#39;1m&#39;, &#39;start&#39;=&#39;2021-01-01 00:00:00&#39;) from root.test.d1</p><h3 id="lowpass" tabindex="-1"><a class="header-anchor" href="#lowpass" aria-hidden="true">#</a> LowPass</h3><p>select lowpass(s1,&#39;wpass&#39;=&#39;0.45&#39;) from root.test.d1</p><h2 id="_20、数据质量" tabindex="-1"><a class="header-anchor" href="#_20、数据质量" aria-hidden="true">#</a> 20、数据质量</h2><h3 id="completeness" tabindex="-1"><a class="header-anchor" href="#completeness" aria-hidden="true">#</a> Completeness</h3><h6 id="参数缺省" tabindex="-1"><a class="header-anchor" href="#参数缺省" aria-hidden="true">#</a> 参数缺省</h6><p>select completeness(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h6 id="指定窗口大小" tabindex="-1"><a class="header-anchor" href="#指定窗口大小" aria-hidden="true">#</a> 指定窗口大小</h6><p>select completeness(s1,&quot;window&quot;=&quot;15&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:01:00</p><h3 id="consistency" tabindex="-1"><a class="header-anchor" href="#consistency" aria-hidden="true">#</a> Consistency</h3><h6 id="参数缺省-1" tabindex="-1"><a class="header-anchor" href="#参数缺省-1" aria-hidden="true">#</a> 参数缺省</h6><p>select consistency(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h6 id="指定窗口大小-1" tabindex="-1"><a class="header-anchor" href="#指定窗口大小-1" aria-hidden="true">#</a> 指定窗口大小</h6><p>select consistency(s1,&quot;window&quot;=&quot;15&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:01:00</p><h3 id="timeliness" tabindex="-1"><a class="header-anchor" href="#timeliness" aria-hidden="true">#</a> Timeliness</h3><h6 id="参数缺省-2" tabindex="-1"><a class="header-anchor" href="#参数缺省-2" aria-hidden="true">#</a> 参数缺省</h6><p>select timeliness(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h6 id="指定窗口大小-2" tabindex="-1"><a class="header-anchor" href="#指定窗口大小-2" aria-hidden="true">#</a> 指定窗口大小</h6><p>select timeliness(s1,&quot;window&quot;=&quot;15&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:01:00</p><h3 id="validity" tabindex="-1"><a class="header-anchor" href="#validity" aria-hidden="true">#</a> Validity</h3><h6 id="参数缺省-3" tabindex="-1"><a class="header-anchor" href="#参数缺省-3" aria-hidden="true">#</a> 参数缺省</h6><p>select validity(s1) from root.test.d1 where time &lt;= 2020-01-01 00:00:30</p><h6 id="指定窗口大小-3" tabindex="-1"><a class="header-anchor" href="#指定窗口大小-3" aria-hidden="true">#</a> 指定窗口大小</h6><p>select validity(s1,&quot;window&quot;=&quot;15&quot;) from root.test.d1 where time &lt;= 2020-01-01 00:01:00</p><h3 id="accuracy" tabindex="-1"><a class="header-anchor" href="#accuracy" aria-hidden="true">#</a> Accuracy</h3><p>select Accuracy(t1,t2,t3,m1,m2,m3) from root.test</p><h2 id="_21、数据修复" tabindex="-1"><a class="header-anchor" href="#_21、数据修复" aria-hidden="true">#</a> 21、数据修复</h2><h3 id="timestamprepair" tabindex="-1"><a class="header-anchor" href="#timestamprepair" aria-hidden="true">#</a> TimestampRepair</h3><h5 id="指定标准时间间隔" tabindex="-1"><a class="header-anchor" href="#指定标准时间间隔" aria-hidden="true">#</a> 指定标准时间间隔</h5><p>select timestamprepair(s1,&#39;interval&#39;=&#39;10000&#39;) from root.test.d2</p><h5 id="自动推算标准时间间隔" tabindex="-1"><a class="header-anchor" href="#自动推算标准时间间隔" aria-hidden="true">#</a> 自动推算标准时间间隔</h5><p>select timestamprepair(s1) from root.test.d2</p><h3 id="valuefill" tabindex="-1"><a class="header-anchor" href="#valuefill" aria-hidden="true">#</a> ValueFill</h3><h5 id="使用-linear-方法进行填补" tabindex="-1"><a class="header-anchor" href="#使用-linear-方法进行填补" aria-hidden="true">#</a> 使用 linear 方法进行填补</h5><p>select valuefill(s1) from root.test.d2</p><h5 id="使用-previous-方法进行填补" tabindex="-1"><a class="header-anchor" href="#使用-previous-方法进行填补" aria-hidden="true">#</a> 使用 previous 方法进行填补</h5><p>select valuefill(s1,&quot;method&quot;=&quot;previous&quot;) from root.test.d2</p><h3 id="valuerepair" tabindex="-1"><a class="header-anchor" href="#valuerepair" aria-hidden="true">#</a> ValueRepair</h3><h5 id="使用-screen-方法进行修复" tabindex="-1"><a class="header-anchor" href="#使用-screen-方法进行修复" aria-hidden="true">#</a> 使用 Screen 方法进行修复</h5><p>select valuerepair(s1) from root.test.d2</p><h5 id="使用-lsgreedy-方法进行修复" tabindex="-1"><a class="header-anchor" href="#使用-lsgreedy-方法进行修复" aria-hidden="true">#</a> 使用 LsGreedy 方法进行修复</h5><p>select valuerepair(s1,&#39;method&#39;=&#39;LsGreedy&#39;) from root.test.d2</p><h3 id="masterrepair" tabindex="-1"><a class="header-anchor" href="#masterrepair" aria-hidden="true">#</a> MasterRepair</h3><p>select MasterRepair(t1,t2,t3,m1,m2,m3) from root.test</p><h3 id="seasonalrepair" tabindex="-1"><a class="header-anchor" href="#seasonalrepair" aria-hidden="true">#</a> SeasonalRepair</h3><h5 id="使用经典分解方法进行修复" tabindex="-1"><a class="header-anchor" href="#使用经典分解方法进行修复" aria-hidden="true">#</a> 使用经典分解方法进行修复</h5><p>select seasonalrepair(s1,&#39;period&#39;=3,&#39;k&#39;=2) from root.test.d2</p><h5 id="使用改进的分解方法进行修复" tabindex="-1"><a class="header-anchor" href="#使用改进的分解方法进行修复" aria-hidden="true">#</a> 使用改进的分解方法进行修复</h5><p>select seasonalrepair(s1,&#39;method&#39;=&#39;improved&#39;,&#39;period&#39;=3) from root.test.d2</p><h2 id="_22、序列发现" tabindex="-1"><a class="header-anchor" href="#_22、序列发现" aria-hidden="true">#</a> 22、序列发现</h2><h3 id="consecutivesequences" tabindex="-1"><a class="header-anchor" href="#consecutivesequences" aria-hidden="true">#</a> ConsecutiveSequences</h3><h5 id="手动指定标准时间间隔" tabindex="-1"><a class="header-anchor" href="#手动指定标准时间间隔" aria-hidden="true">#</a> 手动指定标准时间间隔</h5><p>select consecutivesequences(s1,s2,&#39;gap&#39;=&#39;5m&#39;) from root.test.d1</p><h5 id="自动估计标准时间间隔" tabindex="-1"><a class="header-anchor" href="#自动估计标准时间间隔" aria-hidden="true">#</a> 自动估计标准时间间隔</h5><p>select consecutivesequences(s1,s2) from root.test.d1</p><h3 id="consecutivewindows" tabindex="-1"><a class="header-anchor" href="#consecutivewindows" aria-hidden="true">#</a> ConsecutiveWindows</h3><p>select consecutivewindows(s1,s2,&#39;length&#39;=&#39;10m&#39;) from root.test.d1</p><h2 id="_23、机器学习" tabindex="-1"><a class="header-anchor" href="#_23、机器学习" aria-hidden="true">#</a> 23、机器学习</h2><h3 id="ar" tabindex="-1"><a class="header-anchor" href="#ar" aria-hidden="true">#</a> AR</h3><p>select ar(s0,&quot;p&quot;=&quot;2&quot;) from root.test.d0</p><h3 id="representation" tabindex="-1"><a class="header-anchor" href="#representation" aria-hidden="true">#</a> Representation</h3><p>select representation(s0,&quot;tb&quot;=&quot;3&quot;,&quot;vb&quot;=&quot;2&quot;) from root.test.d0</p><h3 id="rm" tabindex="-1"><a class="header-anchor" href="#rm" aria-hidden="true">#</a> RM</h3><p>select rm(s0, s1,&quot;tb&quot;=&quot;3&quot;,&quot;vb&quot;=&quot;2&quot;) from root.test.d0</p><h1 id="管理触发器" tabindex="-1"><a class="header-anchor" href="#管理触发器" aria-hidden="true">#</a> 管理触发器</h1><h2 id="_1、使用-sql-语句注册该触发器" tabindex="-1"><a class="header-anchor" href="#_1、使用-sql-语句注册该触发器" aria-hidden="true">#</a> 1、使用 SQL 语句注册该触发器</h2><p>// Create Trigger</p><p>createTrigger</p><p>​ : CREATE triggerType TRIGGER triggerName=identifier triggerEventClause ON pathPattern AS className=STRING_LITERAL uriClause? triggerAttributeClause?</p><p>​ ;</p><p>triggerType</p><p>​ : STATELESS | STATEFUL</p><p>​ ;</p><p>triggerEventClause</p><p>​ : (BEFORE | AFTER) INSERT</p><p>​ ;</p><p>uriClause</p><p>​ : USING URI uri</p><p>​ ;</p><p>uri</p><p>​ : STRING_LITERAL</p><p>​ ;</p><p>triggerAttributeClause</p><p>​ : WITH LR_BRACKET triggerAttribute (COMMA triggerAttribute)* RR_BRACKET</p><p>​ ;</p><p>triggerAttribute</p><p>​ : key=attributeKey operator_eq value=attributeValue</p><p>​ ;</p><h3 id="sql-语句示例" tabindex="-1"><a class="header-anchor" href="#sql-语句示例" aria-hidden="true">#</a> SQL 语句示例:</h3><p>CREATE STATELESS TRIGGER triggerTest</p><p>BEFORE INSERT</p><p>ON <a href="http://root.sg" target="_blank" rel="noopener noreferrer">root.sg<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>.**</p><p>AS &#39;org.apache.iotdb.trigger.ClusterAlertingExample&#39;</p><p>USING URI &#39;<a href="http://jar/ClusterAlertingExample.jar" target="_blank" rel="noopener noreferrer">http://jar/ClusterAlertingExample.jar<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span></a>&#39;</p><p>WITH (</p><p>​ &quot;name&quot; = &quot;trigger&quot;,</p><p>​ &quot;limit&quot; = &quot;100&quot;</p><p>)</p><h2 id="_2、卸载触发器" tabindex="-1"><a class="header-anchor" href="#_2、卸载触发器" aria-hidden="true">#</a> 2、卸载触发器</h2><h3 id="卸载触发器的-sql-语法如下" tabindex="-1"><a class="header-anchor" href="#卸载触发器的-sql-语法如下" aria-hidden="true">#</a> 卸载触发器的 SQL 语法如下:</h3><p>// Drop Trigger</p><p>dropTrigger</p><p>: DROP TRIGGER triggerName=identifier</p><p>;</p><h3 id="示例语句" tabindex="-1"><a class="header-anchor" href="#示例语句" aria-hidden="true">#</a> 示例语句:</h3><p>DROP TRIGGER triggerTest1</p><h2 id="查询触发器" tabindex="-1"><a class="header-anchor" href="#查询触发器" aria-hidden="true">#</a> 查询触发器</h2><p>SHOW TRIGGERS</p><h1 id="权限管理" tabindex="-1"><a class="header-anchor" href="#权限管理" aria-hidden="true">#</a> 权限管理</h1><h2 id="_1、创建用户" tabindex="-1"><a class="header-anchor" href="#_1、创建用户" aria-hidden="true">#</a> 1、创建用户</h2><p>CREATE USER <code>ln_write_user</code> &#39;write_pwd&#39;</p><p>CREATE USER <code>sgcc_write_user</code> &#39;write_pwd&#39;</p><h2 id="_2、展示用户" tabindex="-1"><a class="header-anchor" href="#_2、展示用户" aria-hidden="true">#</a> 2、展示用户</h2><p>LIST USER</p><h2 id="_3、赋予用户权限" tabindex="-1"><a class="header-anchor" href="#_3、赋予用户权限" aria-hidden="true">#</a> 3、赋予用户权限</h2><p>INSERT INTO root.ln.wf01.wt01(timestamp,status) values(1509465600000,true)</p><p>系统不允许用户进行此操作,会提示错误:</p><p>IoTDB&gt; INSERT INTO root.ln.wf01.wt01(timestamp,status) values(1509465600000,true)</p><p>Msg: 602: No permissions for this operation, please add privilege INSERT_TIMESERIES.</p><p>用root用户分别赋予他们向对应 database 数据的写入权限</p><p>GRANT USER <code>ln_write_user</code> PRIVILEGES INSERT_TIMESERIES on root.ln.**</p><p>GRANT USER <code>sgcc_write_user</code> PRIVILEGES INSERT_TIMESERIES on root.sgcc1.<strong>, root.sgcc2.</strong></p><p>GRANT USER <code>ln_write_user</code> PRIVILEGES CREATE_USER</p><p>使用ln_write_user再尝试写入数据</p><p>IoTDB&gt; INSERT INTO root.ln.wf01.wt01(timestamp, status) values(1509465600000, true)</p><p>Msg: The statement is executed successfully.</p><h2 id="_4、撤销用户权限" tabindex="-1"><a class="header-anchor" href="#_4、撤销用户权限" aria-hidden="true">#</a> 4、撤销用户权限</h2><p>用root用户撤销ln_write_user和sgcc_write_user的权限:</p><p>REVOKE USER <code>ln_write_user</code> PRIVILEGES INSERT_TIMESERIES on root.ln.**</p><p>REVOKE USER <code>sgcc_write_user</code> PRIVILEGES INSERT_TIMESERIES on root.sgcc1.<strong>, root.sgcc2.</strong></p><p>REVOKE USER <code>ln_write_user</code> PRIVILEGES CREATE_USER</p><p>撤销权限后,ln_write_user就没有向root.ln.**写入数据的权限了</p><p>INSERT INTO root.ln.wf01.wt01(timestamp, status) values(1509465600000, true)</p><p>Msg: 602: No permissions for this operation, please add privilege INSERT_TIMESERIES.</p><h3 id="_5、sql-语句" tabindex="-1"><a class="header-anchor" href="#_5、sql-语句" aria-hidden="true">#</a> 5、SQL 语句</h3><ul><li>创建用户</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>CREATE USER &lt;userName&gt; &lt;password&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; CREATE USER <code>thulab</code> &#39;passwd&#39;;</p><ul><li>删除用户</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>DROP USER &lt;userName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; DROP USER <code>xiaoming</code>;</p><ul><li>创建角色</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>CREATE ROLE &lt;roleName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; CREATE ROLE <code>admin</code>;</p><ul><li>删除角色</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>DROP USER &lt;userName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; DROP USER <code>xiaoming</code>;</p><ul><li>赋予用户权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>GRANT USER &lt;userName&gt; PRIVILEGES &lt;privileges&gt; ON &lt;nodeNames&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; GRANT USER <code>tempuser</code> PRIVILEGES INSERT_TIMESERIES, DELETE_TIMESERIES on root.ln.<strong>, root.sgcc.</strong>;</p><p>Eg: IoTDB &gt; GRANT USER <code>tempuser</code> PRIVILEGES CREATE_ROLE;</p><ul><li>赋予用户全部的权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>GRANT USER &lt;userName&gt; PRIVILEGES ALL;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; GRANT USER <code>tempuser</code> PRIVILEGES ALL;</p><ul><li>赋予角色权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>GRANT ROLE &lt;roleName&gt; PRIVILEGES &lt;privileges&gt; ON &lt;nodeNames&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; GRANT ROLE <code>temprole</code> PRIVILEGES INSERT_TIMESERIES, DELETE_TIMESERIES ON root.sgcc.<strong>, root.ln.</strong>;</p><p>Eg: IoTDB &gt; GRANT ROLE <code>temprole</code> PRIVILEGES CREATE_ROLE;</p><ul><li>赋予角色全部的权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>GRANT ROLE &lt;roleName&gt; PRIVILEGES ALL;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; GRANT ROLE <code>temprole</code> PRIVILEGES ALL;</p><ul><li>赋予用户角色</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>GRANT &lt;roleName&gt; TO &lt;userName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; GRANT <code>temprole</code> TO tempuser;</p><ul><li>撤销用户权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>REVOKE USER &lt;userName&gt; PRIVILEGES &lt;privileges&gt; ON &lt;nodeNames&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; REVOKE USER <code>tempuser</code> PRIVILEGES DELETE_TIMESERIES on root.ln.**;</p><p>Eg: IoTDB &gt; REVOKE USER <code>tempuser</code> PRIVILEGES CREATE_ROLE;</p><ul><li>移除用户所有权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>REVOKE USER &lt;userName&gt; PRIVILEGES ALL;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; REVOKE USER <code>tempuser</code> PRIVILEGES ALL;</p><ul><li>撤销角色权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>REVOKE ROLE &lt;roleName&gt; PRIVILEGES &lt;privileges&gt; ON &lt;nodeNames&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; REVOKE ROLE <code>temprole</code> PRIVILEGES DELETE_TIMESERIES ON root.ln.**;</p><p>Eg: IoTDB &gt; REVOKE ROLE <code>temprole</code> PRIVILEGES CREATE_ROLE;</p><ul><li>撤销角色全部的权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>REVOKE ROLE &lt;roleName&gt; PRIVILEGES ALL;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; REVOKE ROLE <code>temprole</code> PRIVILEGES ALL;</p><ul><li>撤销用户角色</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>REVOKE &lt;roleName&gt; FROM &lt;userName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; REVOKE <code>temprole</code> FROM tempuser;</p><ul><li>列出所有用户</li></ul><p>LIST USER</p><p>Eg: IoTDB &gt; LIST USER</p><ul><li>列出指定角色下所有用户</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>LIST USER OF ROLE &lt;roleName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; LIST USER OF ROLE <code>roleuser</code>;</p><ul><li>列出所有角色</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>REVOKE &lt;roleName&gt; FROM &lt;userName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; REVOKE <code>temprole</code> FROM tempuser;</p><ul><li>列出指定用户下所有角色</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>LIST USER OF ROLE &lt;roleName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; LIST USER OF ROLE <code>roleuser</code>;</p><ul><li>列出用户所有权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>LIST PRIVILEGES USER &lt;username&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; LIST PRIVILEGES USER <code>tempuser</code>;</p><ul><li>列出用户在具体路径上相关联的权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>LIST PRIVILEGES USER &lt;username&gt; ON &lt;paths&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB&gt; LIST PRIVILEGES USER <code>tempuser</code> ON root.ln.<strong>, root.ln.wf01.</strong>;</p><p>IoTDB&gt; LIST PRIVILEGES USER <code>tempuser</code> ON root.ln.wf01.wt01.**;</p><ul><li>列出角色所有权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>LIST PRIVILEGES ROLE &lt;roleName&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; LIST PRIVILEGES ROLE <code>actor</code>;</p><ul><li>列出角色在具体路径上相关联的权限</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>LIST PRIVILEGES ROLE &lt;roleName&gt; ON &lt;paths&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB&gt; LIST PRIVILEGES ROLE <code>temprole</code> ON root.ln.<strong>, root.ln.wf01.wt01.</strong>;</p><p>IoTDB&gt; LIST PRIVILEGES ROLE <code>temprole</code> ON root.ln.wf01.wt01.**;</p><ul><li>更新密码</li></ul><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>ALTER USER &lt;username&gt; SET PASSWORD &lt;password&gt;;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Eg: IoTDB &gt; ALTER USER <code>tempuser</code> SET PASSWORD &#39;newpwd&#39;;</p><h3 id="_6、非root用户限制进行的操作" tabindex="-1"><a class="header-anchor" href="#_6、非root用户限制进行的操作" aria-hidden="true">#</a> 6、非root用户限制进行的操作</h3><h6 id="tsfile管理" tabindex="-1"><a class="header-anchor" href="#tsfile管理" aria-hidden="true">#</a> TsFile管理</h6><ul><li>加载TsFile</li></ul><p>Eg: IoTDB &gt; load &#39;/Users/Desktop/data/1575028885956-101-0.tsfile&#39;</p><ul><li>删除TsFile文件</li></ul><p>Eg: IoTDB &gt; remove &#39;/Users/Desktop/data/data/root.vehicle/0/0/1575028885956-101-0.tsfile&#39;</p><ul><li>卸载TsFile文件到指定目录</li></ul><p>Eg: IoTDB &gt; unload &#39;/Users/Desktop/data/data/root.vehicle/0/0/1575028885956-101-0.tsfile&#39; &#39;/data/data/tmp&#39;</p><h6 id="删除时间分区-实验性功能" tabindex="-1"><a class="header-anchor" href="#删除时间分区-实验性功能" aria-hidden="true">#</a> 删除时间分区(实验性功能)</h6><ul><li>删除时间分区(实验性功能)</li></ul><p>Eg: IoTDB &gt; DELETE PARTITION root.ln 0,1,2</p><h6 id="连续查询" tabindex="-1"><a class="header-anchor" href="#连续查询" aria-hidden="true">#</a> 连续查询</h6><ul><li>连续查询(CQ)</li></ul><p>Eg: IoTDB &gt; CREATE CONTINUOUS QUERY cq1 BEGIN SELECT max_value(temperature) INTO temperature_max FROM root.ln.<em>.</em> GROUP BY time(10s) END</p><h6 id="运维命令" tabindex="-1"><a class="header-anchor" href="#运维命令" aria-hidden="true">#</a> 运维命令</h6><ul><li>FLUSH</li></ul><p>Eg: IoTDB &gt; flush</p><ul><li>MERGE</li></ul><p>Eg: IoTDB &gt; MERGE</p><p>Eg: IoTDB &gt; FULL MERGE</p><ul><li>CLEAR CACHE</li></ul><p>Eg: IoTDB &gt; CLEAR CACHE</p><ul><li>SET STSTEM TO READONLY / WRITABLE</li></ul><p>Eg: IoTDB &gt; SET STSTEM TO READONLY / WRITABLE</p><ul><li>SCHEMA SNAPSHOT</li></ul><p>Eg: IoTDB &gt; CREATE SNAPSHOT FOR SCHEMA</p><ul><li>查询终止</li></ul><p>Eg: IoTDB &gt; KILL QUERY 1</p><h6 id="水印工具" tabindex="-1"><a class="header-anchor" href="#水印工具" aria-hidden="true">#</a> 水印工具</h6><ul><li>为新用户施加水印</li></ul><p>Eg: IoTDB &gt; grant watermark_embedding to Alice</p><ul><li>撤销水印</li></ul><p>Eg: IoTDB &gt; revoke watermark_embedding from Alice</p><h1 id="运维命令-1" tabindex="-1"><a class="header-anchor" href="#运维命令-1" aria-hidden="true">#</a> 运维命令</h1><h2 id="_1、flush" tabindex="-1"><a class="header-anchor" href="#_1、flush" aria-hidden="true">#</a> 1、FLUSH</h2><p>IoTDB&gt; FLUSH</p><p>IoTDB&gt; FLUSH ON LOCAL</p><p>IoTDB&gt; FLUSH ON CLUSTER</p><p>IoTDB&gt; FLUSH root.ln</p><p>IoTDB&gt; FLUSH root.sg1,root.sg2 ON LOCAL</p><p>IoTDB&gt; FLUSH root.sg1,root.sg2 ON CLUSTER</p><h2 id="_2、clear-cache" tabindex="-1"><a class="header-anchor" href="#_2、clear-cache" aria-hidden="true">#</a> 2、CLEAR CACHE</h2><p>IoTDB&gt; CLEAR CACHE</p><p>IoTDB&gt; CLEAR CACHE ON LOCAL</p><p>IoTDB&gt; CLEAR CACHE ON CLUSTER</p><h2 id="_3、set-system-to-readonly-running" tabindex="-1"><a class="header-anchor" href="#_3、set-system-to-readonly-running" aria-hidden="true">#</a> 3、SET SYSTEM TO READONLY / RUNNING</h2><p>IoTDB&gt; SET SYSTEM TO RUNNING</p><p>IoTDB&gt; SET SYSTEM TO READONLY ON LOCAL</p><p>IoTDB&gt; SET SYSTEM TO READONLY ON CLUSTER</p><h2 id="_4、终止查询" tabindex="-1"><a class="header-anchor" href="#_4、终止查询" aria-hidden="true">#</a> 4、终止查询</h2><h3 id="查询超时" tabindex="-1"><a class="header-anchor" href="#查询超时" aria-hidden="true">#</a> 查询超时</h3><p>IoTDB&gt; select * from root.**;</p><p>Msg: 701 Current query is time out, please check your statement or modify timeout parameter.</p><h3 id="查询终止" tabindex="-1"><a class="header-anchor" href="#查询终止" aria-hidden="true">#</a> 查询终止</h3><h4 id="终止指定查询" tabindex="-1"><a class="header-anchor" href="#终止指定查询" aria-hidden="true">#</a> 终止指定查询</h4><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>KILL QUERY &lt;queryId&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h5 id="示例" tabindex="-1"><a class="header-anchor" href="#示例" aria-hidden="true">#</a> 示例</h5><p>kill query &#39;20221205_114444_00003_5&#39;</p><h4 id="终止所有查询" tabindex="-1"><a class="header-anchor" href="#终止所有查询" aria-hidden="true">#</a> 终止所有查询</h4><p>KILL ALL QUERIES</p><h2 id="_5、show-queries" tabindex="-1"><a class="header-anchor" href="#_5、show-queries" aria-hidden="true">#</a> 5、SHOW QUERIES</h2><h3 id="语法-1" tabindex="-1"><a class="header-anchor" href="#语法-1" aria-hidden="true">#</a> 语法</h3><p>SHOW QUERIES | (QUERY PROCESSLIST)</p><p>[WHERE whereCondition]</p><p>[ORDER BY sortKey {ASC | DESC}]</p><p>[LIMIT rowLimit] [OFFSET rowOffset]</p><h3 id="sql示例" tabindex="-1"><a class="header-anchor" href="#sql示例" aria-hidden="true">#</a> SQL示例</h3><h4 id="示例1-获取当前所有执行时间大于30s的查询" tabindex="-1"><a class="header-anchor" href="#示例1-获取当前所有执行时间大于30s的查询" aria-hidden="true">#</a> 示例1:获取当前所有执行时间大于30s的查询</h4><p>SHOW QUERIES WHERE ElapsedTime &gt; 30</p><h4 id="示例2-获取当前执行耗时top5的查询" tabindex="-1"><a class="header-anchor" href="#示例2-获取当前执行耗时top5的查询" aria-hidden="true">#</a> 示例2:获取当前执行耗时Top5的查询</h4><p>SHOW QUERIES limit 5</p><p>SHOW QUERIES ORDER BY ElapsedTime DESC limit 5</p><h1 id="tsfile-同步" tabindex="-1"><a class="header-anchor" href="#tsfile-同步" aria-hidden="true">#</a> TsFile 同步</h1><h2 id="快速上手" tabindex="-1"><a class="header-anchor" href="#快速上手" aria-hidden="true">#</a> 快速上手</h2><ul><li>创建接收端为 IoTDB 类型的 Pipe Sink</li></ul><p>IoTDB&gt; CREATE PIPESINK my_iotdb AS IoTDB (ip=&#39;接收端IP&#39;, port=&#39;接收端端口&#39;)</p><ul><li>创建同步任务Pipe(请确保接收端 IoTDB 已经启动)</li></ul><p>IoTDB&gt; CREATE PIPE my_pipe TO my_iotdb</p><ul><li>开始同步任务</li></ul><p>IoTDB&gt; START PIPE my_pipe</p><ul><li>显示所有同步任务状态</li></ul><p>IoTDB&gt; SHOW PIPES</p><ul><li>暂停任务</li></ul><p>IoTDB&gt; STOP PIPE my_pipe</p><ul><li>继续被暂停的任务</li></ul><p>IoTDB&gt; START PIPE my_pipe</p><ul><li>关闭任务(状态信息将被删除)</li></ul><p>IoTDB&gt; DROP PIPE my_pipe</p><h2 id="sql" tabindex="-1"><a class="header-anchor" href="#sql" aria-hidden="true">#</a> SQL</h2><h3 id="show-pipesinktype" tabindex="-1"><a class="header-anchor" href="#show-pipesinktype" aria-hidden="true">#</a> SHOW PIPESINKTYPE</h3><p>IoTDB&gt; SHOW PIPESINKTYPE</p><h3 id="create-pipesink" tabindex="-1"><a class="header-anchor" href="#create-pipesink" aria-hidden="true">#</a> CREATE PIPESINK</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>IoTDB&gt; CREATE PIPESINK &lt;PipeSinkName&gt; AS IoTDB [(ip=&#39;127.0.0.1&#39;,port=6667);]
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="drop-pipesink" tabindex="-1"><a class="header-anchor" href="#drop-pipesink" aria-hidden="true">#</a> DROP PIPESINK</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>IoTDB&gt; DROP PIPESINK &lt;PipeSinkName&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="show-pipesink" tabindex="-1"><a class="header-anchor" href="#show-pipesink" aria-hidden="true">#</a> SHOW PIPESINK</h3><p>IoTDB&gt; SHOW PIPESINKS IoTDB&gt; SHOW PIPESINK [PipeSinkName]</p><h3 id="create-pipe" tabindex="-1"><a class="header-anchor" href="#create-pipe" aria-hidden="true">#</a> CREATE PIPE</h3><p>IoTDB&gt; CREATE PIPE my_pipe TO my_iotdb [FROM (select ** from root WHERE time&gt;=yyyy-mm-dd HH:MM:SS)]</p><h3 id="stop-pipe" tabindex="-1"><a class="header-anchor" href="#stop-pipe" aria-hidden="true">#</a> STOP PIPE</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>IoTDB&gt; STOP PIPE &lt;PipeName&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="start-pipe" tabindex="-1"><a class="header-anchor" href="#start-pipe" aria-hidden="true">#</a> START PIPE</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>IoTDB&gt; START PIPE &lt;PipeName&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="drop-pipe" tabindex="-1"><a class="header-anchor" href="#drop-pipe" aria-hidden="true">#</a> DROP PIPE</h3><div class="language-Go line-numbers-mode" data-ext="Go"><pre class="language-Go"><code>IoTDB&gt; DROP PIPE &lt;PipeName&gt;
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="show-pipe" tabindex="-1"><a class="header-anchor" href="#show-pipe" aria-hidden="true">#</a> SHOW PIPE</h3><p>IoTDB&gt; SHOW PIPES</p><p>IoTDB&gt; SHOW PIPE [PipeName]</p><hr class="footnotes-sep"><section class="footnotes"><ol class="footnotes-list"><li id="footnote1" class="footnote-item"><p>A-Za-z <a href="#footnote-ref1" class="footnote-backref">↩︎</a></p></li><li id="footnote2" class="footnote-item"><p>a-z <a href="#footnote-ref2" class="footnote-backref">↩︎</a></p></li><li id="footnote3" class="footnote-item"><p>A-Za-z <a href="#footnote-ref3" class="footnote-backref">↩︎</a></p></li><li id="footnote4" class="footnote-item"><p>a-z <a href="#footnote-ref4" class="footnote-backref">↩︎</a></p></li></ol></section></div><!----><footer class="page-meta"><div class="meta-item edit-link"><a href="https://github.com/apache/iotdb-docs/edit/main/src/zh/UserGuide/V1.2.x/SQL-Manual/SQL-Manual.md" rel="noopener noreferrer" target="_blank" aria-label="发现错误?在 GitHub 上编辑此页" class="nav-link label"><!--[--><svg xmlns="http://www.w3.org/2000/svg" class="icon edit-icon" viewBox="0 0 1024 1024" fill="currentColor" aria-label="edit icon"><path d="M430.818 653.65a60.46 60.46 0 0 1-50.96-93.281l71.69-114.012 7.773-10.365L816.038 80.138A60.46 60.46 0 0 1 859.225 62a60.46 60.46 0 0 1 43.186 18.138l43.186 43.186a60.46 60.46 0 0 1 0 86.373L588.879 565.55l-8.637 8.637-117.466 68.234a60.46 60.46 0 0 1-31.958 11.229z"></path><path d="M728.802 962H252.891A190.883 190.883 0 0 1 62.008 771.98V296.934a190.883 190.883 0 0 1 190.883-192.61h267.754a60.46 60.46 0 0 1 0 120.92H252.891a69.962 69.962 0 0 0-69.098 69.099V771.98a69.962 69.962 0 0 0 69.098 69.098h475.911A69.962 69.962 0 0 0 797.9 771.98V503.363a60.46 60.46 0 1 1 120.922 0V771.98A190.883 190.883 0 0 1 728.802 962z"></path></svg><!--]-->发现错误?在 GitHub 上编辑此页<span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><span class="external-link-icon-sr-only">open in new window</span></span><!----></a></div><div class="meta-item git-info"><div class="update-time"><span class="label">上次编辑于: </span><!----></div><div class="contributors"><span class="label">贡献者: </span><!--[--><!--[--><span class="contributor" title="email: 43237967+2b3c511@users.noreply.github.com">Summer</span><!--]--><!--]--></div></div></footer><!----><!----><!----><!--]--></main><!--]--><footer style="padding-bottom:2rem;"><span id="doc-version" style="display:none;">rel/1.2</span><p style="text-align:center;color:#909399;font-size:12px;margin:0 30px;">Copyright © 2023 The Apache Software Foundation.<br> Apache and the Apache feather logo are trademarks of The Apache Software Foundation</p><p style="text-align:center;margin-top:10px;color:#909399;font-size:12px;margin:0 30px;"><strong>Have a question?</strong> Connect with us on QQ, WeChat, or Slack. <a href="https://github.com/apache/iotdb/issues/1995">Join the community</a> now.</p><p style="text-align:center;margin-top:10px;color:#909399;font-size:12px;margin:0 30px;"> We use <a href="https://analytics.google.com">Google Analytics</a> to collect anonymous, aggregated usage information. </p></footer></div><!--]--><!--]--><!----><!--]--></div>
<script type="module" src="/assets/app-83ad958f.js" defer></script>
</body>
</html>