Clickhouse 可以通过set 来设置参数值,通过show setting 来查看当前的值。 参数内容是保存在system.settings元数据表里面的。
目录导航
参考
Clickhouse 设置和查看参数值set和show settings
system.settings表结构
一共8个字段。
表结构
| 列名 | 类型 | 说明 | 
|---|---|---|
| name | String | 参数名字 | 
| value | String | 参数值 | 
| changed | UInt8 | 参数相对默认值,是否修改过 | 
| description | String | 参数的简短描述信息 | 
| min | Nullable(String) | 参数的最小值,如果没有则为null | 
| max | Nullable(String) | 参数的最大值,如果没有则为null | 
| readonly | UInt8 | 参数是否只读,不可修改 0:可以修改 1:不可以修改 | 
| type | String | 参数分类,和字段基本类型对应,UInt31,UInt64,String之类的 | 
支持的类型列表
localhost :) select distinct type from system.settings
SELECT DISTINCT type
FROM system.settings
Query id: 07ce6a1e-1280-4a14-aee5-6db5af39b74d
┌─type─────────────────────┐
│ UInt64                   │
│ MaxThreads               │
│ Seconds                  │
│ Milliseconds             │
│ Bool                     │
│ LoadBalancing            │
│ TotalsMode               │
│ Float                    │
│ String                   │
│ Int64                    │
│ LogQueriesType           │
│ DistributedProductMode   │
│ JoinStrictness           │
│ OverflowMode             │
│ OverflowModeGroupBy      │
│ JoinAlgorithm            │
│ LogsLevel                │
│ DefaultDatabaseEngine    │
│ MySQLDataTypesSupport    │
│ DistributedDDLOutputMode │
│ UnionMode                │
│ Char                     │
│ DateTimeInputFormat      │
│ DateTimeOutputFormat     │
│ URI                      │
└──────────────────────────┘
25 rows in set. Elapsed: 0.009 sec.
DESC输出
localhost :) desc system.settings ;
DESCRIBE TABLE system.settings
Query id: de9c3f5f-44f3-4713-b7bc-bfec1c6901e9
┌─name────────┬─type─────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ name        │ String           │              │                    │         │                  │                │
│ value       │ String           │              │                    │         │                  │                │
│ changed     │ UInt8            │              │                    │         │                  │                │
│ description │ String           │              │                    │         │                  │                │
│ min         │ Nullable(String) │              │                    │         │                  │                │
│ max         │ Nullable(String) │              │                    │         │                  │                │
│ readonly    │ UInt8            │              │                    │         │                  │                │
│ type        │ String           │              │                    │         │                  │                │
└─────────────┴──────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
8 rows in set. Elapsed: 0.004 sec.
使用样例
localhost :) select * from system.settings limit 1\G
SELECT *
FROM system.settings
LIMIT 1
Query id: 419e76fc-2079-445b-ad45-e79099ccba66
Row 1:
──────
name:        min_compress_block_size
value:       65536
changed:     0
description: The actual size of the block to compress, if the uncompressed data less than max_compress_block_size is no less than this value and no less than the volume of data for one mark.
min:         ᴺᵁᴸᴸ
max:         ᴺᵁᴸᴸ
readonly:    0
type:        UInt64
1 rows in set. Elapsed: 0.004 sec.
localhost :)