系统。设置 

包含有关当前用户的会话设置的信息。

列:

  • name (字符串) — Setting name.
  • value (字符串) — Setting value.
  • changed (UInt8) — Shows whether a setting is changed from its default value.
  • description (字符串) — Short setting description.
  • min (可为空(字符串)) — Minimum value of the setting, if any is set via 制约因素. 如果设置没有最小值,则包含 NULL.
  • max (可为空(字符串)) — Maximum value of the setting, if any is set via 制约因素. 如果设置没有最大值,则包含 NULL.
  • readonly (UInt8) — Shows whether the current user can change the setting:
    • 0 — Current user can change the setting.
    • 1 — Current user can't change the setting.

示例

下面的示例演示如何获取有关名称包含的设置的信息 min_i.

SELECT *
FROM system.settings
WHERE name LIKE '%min_i%'
┌─name────────────────────────────────────────┬─value─────┬─changed─┬─description───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─min──┬─max──┬─readonly─┐
│ min_insert_block_size_rows                  │ 1048576   │       0 │ Squash blocks passed to INSERT query to specified size in rows, if blocks are not big enough.                                                                         │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │        0 │
│ min_insert_block_size_bytes                 │ 268435456 │       0 │ Squash blocks passed to INSERT query to specified size in bytes, if blocks are not big enough.                                                                        │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │        0 │
│ read_backoff_min_interval_between_events_ms │ 1000      │       0 │ Settings to reduce the number of threads in case of slow reads. Do not pay attention to the event, if the previous one has passed less than a certain amount of time. │ ᴺᵁᴸᴸ │ ᴺᵁᴸᴸ │        0 │
└─────────────────────────────────────────────┴───────────┴─────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴──────┴──────┴──────────┘

使用 WHERE changed 可以是有用的,例如,当你想检查:

  • 配置文件中的设置是否正确加载并正在使用。
  • 在当前会话中更改的设置。
SELECT * FROM system.settings WHERE changed AND name='load_balancing'

另请参阅

Rating: 4 - 1 votes

Was this content helpful?
★★★★☆