SHOW PARAMETERS

列出所有可以设置的账户、会话和对象参数,以及每个参数的当前值和默认值:

  • 账户参数只能在账户级别设置。

  • 可以在账户、用户和会话级别设置会话参数。

  • 可以在账户和对象级别设置对象参数。

如果已显式设置参数,则此命令的输出还会显示已设置参数的级别。

有关不同参数类型的说明以及每个参数的详细说明,请参阅 参数

语法

SHOW PARAMETERS
  [ LIKE '<pattern>' ]
  [ { IN | FOR } {
        { SESSION | ACCOUNT }
      | { USER | WAREHOUSE | DATABASE | SCHEMA | TASK } [ <name> ]
      | TABLE [ <table_or_view_name> ]
    } ]
Copy

参数

LIKE 'pattern'

(可选)按对象名称筛选命令输出。筛选器使用 不区分大小写 的模式匹配,并支持 SQL 通配符(%_)。

例如,以下模式返回 相同的 结果:

... LIKE '%testing%' ...
... LIKE '%TESTING%' ...

. 默认:无值(不对输出应用筛选)。

IN | FOR

IN ...FOR ... 指定命令的作用域,该作用域确定返回的参数:

SESSION

返回当前会话的所有会话参数及其设置。用户可以使用 ALTER SESSION 更改其会话的这些参数。

ACCOUNT

返回可在账户级别设置的账户、会话和对象参数的列表。具有 ACCOUNTADMIN 角色的用户(即账户管理员)可通过 ALTER ACCOUNT 更改这些参数。有关更多信息,请参阅 参数管理

USER [ name ]

返回指定用户(或当前用户)每次登录时为其设置的会话参数默认值列表。

  • 如果未指定用户,则该命令将返回当前用户的结果。

  • 具有适当用户权限的管理员可以使用 ALTER USER 更改用户的会话参数默认值。

  • 单个用户还可以使用 ALTER USER 更改其会话参数默认值。

WAREHOUSE | DATABASE | SCHEMA | TASK [ name ]

返回可为当前/指定对象设置的对象参数。具有适当权限的用户可以使用相应的 ALTER <object> 命令更改这些参数。

TABLE [ table_or_view_name ]

返回可为指定表或视图设置的对象参数。具有适当权限的用户可以使用 ALTER TABLE 命令更改这些参数。

使用 TABLE 作为所有类似表的对象的域,例如表、视图和物化视图。

默认:SESSION

使用说明

  • 该命令不需要正在运行的仓库即可执行。

  • 若要对此命令的输出进行后处理,可以使用 RESULT_SCAN 函数,该函数会将输出视为可查询的表。

示例

显示可为当前会话设置的所有会话参数:

SHOW PARAMETERS;

+-------------------------------------+----------------------------------+----------------------------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| key                                 | value                            | default                          | level   | description                                                                                                                                                                         |
|-------------------------------------+----------------------------------+----------------------------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ABORT_DETACHED_QUERY                | false                            | false                            | SESSION | If true, Snowflake will automatically abort queries when it detects that the client has disappeared.                                                                                |
| AUTOCOMMIT                          | true                             | true                             | SESSION | The autocommit property determines whether is statement should to be implicitly                                                                                                     |
|                                     |                                  |                                  |         | wrapped within a transaction or not. If autocommit is set to true, then a                                                                                                           |
|                                     |                                  |                                  |         | statement that requires a transaction is executed within a transaction                                                                                                              |
|                                     |                                  |                                  |         | implicitly. If autocommit is off then an explicit commit or rollback is required                                                                                                    |
|                                     |                                  |                                  |         | to close a transaction. The default autocommit value is true.                                                                                                                       |
| AUTOCOMMIT_API_SUPPORTED            | true                             | true                             |         | Whether autocommit feature is enabled for this client. This parameter is for                                                                                                        |
|                                     |                                  |                                  |         | Snowflake use only.                                                                                                                                                                 |
| BINARY_INPUT_FORMAT                 | HEX                              | HEX                              |         | input format for binary                                                                                                                                                             |
| BINARY_OUTPUT_FORMAT                | HEX                              | HEX                              |         | display format for binary                                                                                                                                                           |
| CLIENT_SESSION_KEEP_ALIVE           | false                            | false                            |         | If true, client session will not expire automatically                                                                                                                               |
| DATE_INPUT_FORMAT                   | AUTO                             | AUTO                             |         | input format for date                                                                                                                                                               |
| DATE_OUTPUT_FORMAT                  | YYYY-MM-DD                       | YYYY-MM-DD                       |         | display format for date                                                                                                                                                             |
| ERROR_ON_NONDETERMINISTIC_MERGE     | true                             | true                             |         | raise an error when attempting to merge-update a row that joins many rows                                                                                                           |
| ERROR_ON_NONDETERMINISTIC_UPDATE    | false                            | false                            |         | raise an error when attempting to update a row that joins many rows                                                                                                                 |
| LOCK_TIMEOUT                        | 43200                            | 43200                            |         | Number of seconds to wait while trying to lock a resource, before timing out                                                                                                        |
|                                     |                                  |                                  |         | and aborting the statement. A value of 0 turns off lock waiting i.e. the                                                                                                            |
|                                     |                                  |                                  |         | statement must acquire the lock immediately or abort. If multiple resources                                                                                                         |
|                                     |                                  |                                  |         | need to be locked by the statement, the timeout applies separately to each                                                                                                          |
|                                     |                                  |                                  |         | lock attempt.                                                                                                                                                                       |
| QUERY_TAG                           |                                  |                                  |         | String (up to 2000 characters) used to tag statements executed by the session                                                                                                       |
| QUOTED_IDENTIFIERS_IGNORE_CASE      | false                            | false                            |         | If true, the case of quoted identifiers is ignored                                                                                                                                  |
| ROWS_PER_RESULTSET                  | 0                                | 0                                |         | maxium number of rows in a result set                                                                                                                                               |
| STATEMENT_QUEUED_TIMEOUT_IN_SECONDS | 0                                | 0                                |         | Timeout in seconds for queued statements: statements will automatically be canceled if they are queued on a warehouse for longer than this amount of time; disabled if set to zero. |
| STATEMENT_TIMEOUT_IN_SECONDS        | 0                                | 0                                |         | Timeout in seconds for statements: statements will automatically be canceled if they run for longer than this amount of time; disabled if set to zero.                              |
| TIMESTAMP_DAY_IS_ALWAYS_24H         | false                            | true                             | SYSTEM  | If set, arithmetic on days always uses 24 hours per day,                                                                                                                            |
|                                     |                                  |                                  |         | possibly not preserving the time (due to DST changes)                                                                                                                               |
| TIMESTAMP_INPUT_FORMAT              | AUTO                             | AUTO                             |         | input format for timestamp                                                                                                                                                          |
| TIMESTAMP_LTZ_OUTPUT_FORMAT         |                                  |                                  |         | Display format for TIMESTAMP_LTZ values. If empty, TIMESTAMP_OUTPUT_FORMAT is used.                                                                                                 |
| TIMESTAMP_NTZ_OUTPUT_FORMAT         | YYYY-MM-DD HH24:MI:SS.FF3        | YYYY-MM-DD HH24:MI:SS.FF3        | SYSTEM  | Display format for TIMESTAMP_NTZ values. If empty, TIMESTAMP_OUTPUT_FORMAT is used.                                                                                                 |
| TIMESTAMP_OUTPUT_FORMAT             | YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM | YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM | SYSTEM  | Default display format for all timestamp types.                                                                                                                                     |
| TIMESTAMP_TYPE_MAPPING              | TIMESTAMP_NTZ                    | TIMESTAMP_NTZ                    | SYSTEM  | If TIMESTAMP type is used, what specific TIMESTAMP* type it should map to:                                                                                                          |
|                                     |                                  |                                  |         |   TIMESTAMP_LTZ (default), TIMESTAMP_NTZ or TIMESTAMP_TZ                                                                                                                            |
| TIMESTAMP_TZ_OUTPUT_FORMAT          |                                  |                                  |         | Display format for TIMESTAMP_TZ values. If empty, TIMESTAMP_OUTPUT_FORMAT is used.                                                                                                  |
| TIMEZONE                            | America/Los_Angeles              | America/Los_Angeles              |         | time zone                                                                                                                                                                           |
| TIME_INPUT_FORMAT                   | AUTO                             | AUTO                             |         | input format for time                                                                                                                                                               |
| TIME_OUTPUT_FORMAT                  | HH24:MI:SS                       | HH24:MI:SS                       |         | display format for time                                                                                                                                                             |
| TRANSACTION_ABORT_ON_ERROR          | false                            | false                            |         | If this parameter is true, and a statement issued within a non-autocommit                                                                                                           |
|                                     |                                  |                                  |         | transaction returns with an error, then the non-autocommit transaction is                                                                                                           |
|                                     |                                  |                                  |         | aborted. All statements issued inside that transaction will fail until an                                                                                                           |
|                                     |                                  |                                  |         | commit or rollback statement is executed to close that transaction.                                                                                                                 |
| TRANSACTION_DEFAULT_ISOLATION_LEVEL | READ COMMITTED                   | READ COMMITTED                   |         | The default isolation level when starting a starting a transaction, when no                                                                                                         |
|                                     |                                  |                                  |         | isolation level was specified                                                                                                                                                       |
| TWO_DIGIT_CENTURY_START             | 1970                             | 1970                             |         | For 2-digit dates, defines a century-start year.                                                                                                                                    |
|                                     |                                  |                                  |         | For example, when set to 1980:                                                                                                                                                      |
|                                     |                                  |                                  |         |   - parsing a string '79' will produce 2079                                                                                                                                         |
|                                     |                                  |                                  |         |   - parsing a string '80' will produce 1980                                                                                                                                         |
| UNSUPPORTED_DDL_ACTION              | ignore                           | ignore                           |         | The action to take upon encountering an unsupported ddl statement                                                                                                                   |
| USE_CACHED_RESULT                   | true                             | true                             |         | If enabled, query results can be reused between successive invocations of the same query as long as the original result has not expired                                             |
+-------------------------------------+----------------------------------+----------------------------------+---------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Copy

请注意,此示例的输出不包括任何账户或对象参数,因为无法在会话级别设置这些参数。

有关账户参数以及在账户级别设置参数的更多信息,请参阅 参数管理

显示可为指定仓库 (testwh) 设置的所有对象参数:

SHOW PARAMETERS IN WAREHOUSE testwh;

+-------------------------------------+--------+---------+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| key                                 | value  | default | level | description                                                                                                                                                                                                                   |
|-------------------------------------+--------+---------+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| MAX_CONCURRENCY_LEVEL               | 8      | 8       |       | Concurrency level for SQL statements (i.e. queries and DML) executed by a warehouse cluster (used to determine when statements are queued or additional clusters are started). Small SQL statements count as a fraction of 1. |
| STATEMENT_QUEUED_TIMEOUT_IN_SECONDS | 0      | 0       |       | Timeout in seconds for queued statements: statements will automatically be canceled if they are queued on a warehouse for longer than this amount of time; disabled if set to zero.                                           |
| STATEMENT_TIMEOUT_IN_SECONDS        | 172800 | 172800  |       | Timeout in seconds for statements: statements are automatically canceled if they run for longer; if set to zero, max value (604800) is enforced.                                                                              |
+-------------------------------------+--------+---------+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Copy

显示可为当前数据库 (testdb) 设置的所有对象参数:

USE DATABASE testdb;

SHOW PARAMETERS IN DATABASE;

+-----------------------------+-------+---------+-------+------------------------------------------------------------------+
| key                         | value | default | level | description                                                      |
|-----------------------------+-------+---------+-------+------------------------------------------------------------------|
| DATA_RETENTION_TIME_IN_DAYS | 1     | 1       |       | number of days to retain the old version of deleted/updated data |
+-----------------------------+-------+---------+-------+------------------------------------------------------------------+
Copy
语言: 中文