Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
5f8d7fab
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5f8d7fab
编写于
9月 26, 2020
作者:
A
Anna
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Upd desc and move to string-functions.md
上级
d52e1634
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
97 addition
and
37 deletion
+97
-37
docs/en/sql-reference/functions/string-functions.md
docs/en/sql-reference/functions/string-functions.md
+71
-0
docs/en/sql-reference/functions/url-functions.md
docs/en/sql-reference/functions/url-functions.md
+26
-37
未找到文件。
docs/en/sql-reference/functions/string-functions.md
浏览文件 @
5f8d7fab
...
...
@@ -487,4 +487,75 @@ Returns the CRC64 checksum of a string, using CRC-64-ECMA polynomial.
The result type is UInt64.
## normalizeQuery {#normalized-query}
Replaces literals, sequences of literals and complex aliases with placeholders.
**Syntax**
```
sql
normalizeQuery
(
x
)
```
**Parameters**
-
`x`
— Sequence of characters.
[
String
](
../../sql-reference/data-types/string.md
)
.
**Returned value(s)**
-
Sequence of characters with placeholders.
Type:
[
String
](
../../sql-reference/data-types/string.md
)
.
**Example**
Query:
```
sql
SELECT
normalizeQuery
(
'[1, 2, 3, x]'
)
AS
query
;
```
Result:
```
text
┌─query────┐
│ [?.., x] │
└──────────┘
```
## normalizedQueryHash {#normalized-query-hash}
Returns identical 64bit hash values without the values of literals for similar queries. It helps to analyze query log.
**Syntax**
```
sql
normalizedQueryHash
(
x
)
```
**Parameters**
-
`x`
— Sequence of characters.
[
String
](
../../sql-reference/data-types/string.md
)
.
**Returned value**
-
Hash value.
Type:
[
UInt64
](
../../sql-reference/data-types/int-uint.md#uint-ranges
)
.
**Example**
Query:
```
sql
SELECT
normalizedQueryHash
(
'SELECT 1 AS `xyz`'
)
!=
normalizedQueryHash
(
'SELECT 1 AS `abc`'
)
AS
res
;
```
Result:
```
text
┌─res─┐
│ 1 │
└─────┘
```
[
Original article
](
https://clickhouse.tech/docs/en/query_language/functions/string_functions/
)
<!--hide-->
docs/en/sql-reference/functions/url-functions.md
浏览文件 @
5f8d7fab
...
...
@@ -248,86 +248,75 @@ Removes the ‘name’ URL parameter, if present. This function works under the
Replaces literals, sequences of literals and complex aliases with placeholders.
**Syntax**
(without SELECT)
**Syntax**
```
sql
<
function
syntax
>
normalizeQuery
(
x
)
```
!!! note "Note"
SELECT count(
*
) FROM table WHERE date = '2020-01-02' AND id IN (1, 2, 3) LIMIT 10, 10
should be replaced to
SELECT count(
*
) FROM table WHERE date = ? AND id IN (?) LIMIT ?
Alias:
`<alias name>`
. (Optional)
More text (Optional).
**Parameters**
(Optional)
**Parameters**
-
`x`
— Description.
[
Type name
](
relative/path/to/type/dscr.md#type
)
.
-
`y`
— Description.
[
Type name
](
relative/path/to/type/dscr.md#type
)
.
-
`x`
— Sequence of characters.
[
String
](
../../sql-reference/data-types/string.md
)
.
**Returned value(s)**
-
Returned values list
.
-
Sequence of characters with placeholders
.
Type:
[
Type
](
relative/path/to/type/dscr.md#type
)
.
Type:
[
String
](
../../sql-reference/data-types/string.md
)
.
**Example**
SELECT count(
*
) FROM table WHERE date = '2020-01-02' AND id IN (1, 2, 3) LIMIT 10, 10
should be replaced to
SELECT count(
*
) FROM table WHERE date = ? AND id IN (?) LIMIT ?
Query:
```
sql
SELECT
normalizeQuery
(
'[1, 2, 3, x]'
)
AS
query
;
```
Result:
```
text
┌─query────┐
│ [?.., x] │
└──────────┘
```
## normalizedQueryHash {#normalized-query-hash}
Returns identical 64bit hash values for similar queries. It helps to analyze query log.
calculate a hash of query structure without the values of literals.
Returns identical 64bit hash values without the values of literals for similar queries. It helps to analyze query log.
**Syntax**
(without SELECT)
**Syntax**
```
sql
<function
syntax
>
normalizedQueryHash
(
x
)
```
Alias: `<alias name>`. (Optional)
**Parameters**
More text (Optional
).
-
`x`
— Sequence of characters.
[
String
](
../../sql-reference/data-types/string.md
)
.
**Parameters** (Optional)
- `x` — Description. [Type name](relative/path/to/type/dscr.md#type).
- `y` — Description. [Type name](relative/path/to/type/dscr.md#type).
**Returned value(s)**
**Returned value**
-
Returned values list
.
-
Hash value
.
Type: [
Type](relative/path/to/type/dscr.md#type
).
Type:
[
UInt64
](
../../sql-reference/data-types/int-uint.md#uint-ranges
)
.
**Example**
The example must show usage and/or a use cases. The following text contains recommended parts of an example.
Input table (Optional):
```
text
```
Query:
```
sql
SELECT
normalizedQueryHash
(
'SELECT 1 AS `xyz`'
)
!=
normalizedQueryHash
(
'SELECT 1 AS `abc`'
)
AS
res
;
```
Result:
```
text
┌─res─┐
│ 1 │
└─────┘
```
[
Original article
](
https://clickhouse.tech/docs/en/query_language/functions/url_functions/
)
<!--hide-->
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录