> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# SHOW {session variable}

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

Use the `SHOW` <InternalLink path="sql-statements">statement</InternalLink> to display the value of one or all of the session variables. You configure session variables using <InternalLink path="set-vars">`SET`</InternalLink>.

## Required privileges

No <InternalLink path="security-reference/authorization#managing-privileges">privileges</InternalLink> are required to display the session variables.

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/Bc-7BE4092mn9J_1/images/sql-diagrams/v23.2/show_session.svg?fit=max&auto=format&n=Bc-7BE4092mn9J_1&q=85&s=f8cb9971f30dc37fe9a4e338b61a85e7" alt="show_session syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="381" height="69" data-path="images/sql-diagrams/v23.2/show_session.svg" />

<Note>
  The `SHOW` statement for session variables is unrelated to the other `SHOW` statements like <InternalLink path="show-cluster-setting">`SHOW CLUSTER SETTING`</InternalLink>, <InternalLink path="show-create">`SHOW CREATE`</InternalLink>, and <InternalLink path="show-databases">`SHOW DATABASES`</InternalLink>.
</Note>

## Parameters

| Parameter   | Description                                                                                                    |
| ----------- | -------------------------------------------------------------------------------------------------------------- |
| `var\_name` | The session variable name to show. The variable name is case-insensitive and can be enclosed in double quotes. |

### Supported variables

| Variable name                                                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Initial value                                                                                                                                                                                                                       | Modify with <InternalLink path="set-vars">`SET`</InternalLink>?                                                                                 | View with <InternalLink path="show-vars">`SHOW`</InternalLink>? |     |
| ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | --- |
| `application\_name`                                              | The current application name for statistics collection.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Empty string, or `cockroach` for sessions from the <InternalLink path="cockroach-sql">built-in SQL client</InternalLink>.                                                                                                           | Yes                                                                                                                                             | Yes                                                             |     |
| `bytea\_output`                                                  | The <InternalLink path="bytes#supported-conversions">mode for conversions from `STRING` to `BYTES`</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | hex                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `client\_min\_messages`                                          | The severity level of notices displayed in the <InternalLink path="cockroach-sql">SQL shell</InternalLink>. Accepted values include `debug5`, `debug4`, `debug3`, `debug2`, `debug1`, `log`, `notice`, `warning`, and `error`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `notice`                                                                                                                                                                                                                            | Yes                                                                                                                                             | Yes                                                             |     |
| `copy\_from\_atomic\_enabled`                                    | If set to `on`, <InternalLink path="copy">`COPY FROM`</InternalLink> statements are committed atomically, matching PostgreSQL behavior. If set to `off`, `COPY FROM` statements are segmented into batches of 100 rows unless issued within an explicit transaction, matching the CockroachDB behavior in versions prior to v22.2.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `copy\_transaction\_quality\_of\_service`                        | The default quality of service for <InternalLink path="copy">`COPY`</InternalLink> statements in the current session. The supported options are `regular`, `critical`, and `background`. See <InternalLink path="admission-control">Set quality of service level</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | `background`                                                                                                                                                                                                                        | Yes                                                                                                                                             | Yes                                                             |     |
| `cost\_scans\_with\_default\_col\_size`                          | Whether to prevent the optimizer from considering column size when costing plans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `false`                                                                                                                                                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `crdb\_version`                                                  | The version of CockroachDB.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `CockroachDB OSS version`                                                                                                                                                                                                           | No                                                                                                                                              | Yes                                                             |     |
| `database`                                                       | The <InternalLink path="sql-name-resolution#current-database">current database</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Database in connection string, or empty if not specified.                                                                                                                                                                           | Yes                                                                                                                                             | Yes                                                             |     |
| <a id="datestyle" />                                             | `datestyle`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | The input string format for <InternalLink path="date">`DATE`</InternalLink> and <InternalLink path="timestamp">`TIMESTAMP`</InternalLink> values. Accepted values include `ISO,MDY`, `ISO,DMY`, and `ISO,YMD`.                      | The value set by the `sql.defaults.datestyle`<InternalLink path="cluster-settings">cluster setting</InternalLink> (`ISO,MDY`, by default).      | Yes                                                             | Yes |
| `default\_int\_size`                                             | The size, in bytes, of an <InternalLink path="int">`INT`</InternalLink> type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `8`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `default\_text\_search\_config`                                  | The dictionary used to normalize tokens and eliminate stop words when calling a <InternalLink path="functions-and-operators#full-text-search-functions">full-text search function</InternalLink> without a configuration parameter. See <InternalLink path="full-text-search">Full-Text Search</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `english`                                                                                                                                                                                                                           | Yes                                                                                                                                             | Yes                                                             |     |
| `default\_transaction\_isolation`                                | The isolation level at which transactions in the session execute (<InternalLink path="demo-serializable">`SERIALIZABLE`</InternalLink> or <InternalLink path="read-committed">`READ COMMITTED`</InternalLink>). See <InternalLink path="transactions#isolation-levels">Isolation levels</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `SERIALIZABLE`                                                                                                                                                                                                                      | Yes                                                                                                                                             | Yes                                                             |     |
| `default\_transaction\_priority`                                 | The default transaction priority for the current session. The supported options are `low`, `normal`, and `high`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | `normal`                                                                                                                                                                                                                            | Yes                                                                                                                                             | Yes                                                             |     |
| `default\_transaction\_quality\_of\_service`                     | The default transaction quality of service for the current session. The supported options are `regular`, `critical`, and `background`. See <InternalLink path="admission-control#set-quality-of-service-level-for-a-session">Set quality of service level</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `regular`                                                                                                                                                                                                                           | Yes                                                                                                                                             | Yes                                                             |     |
| `default\_transaction\_read\_only`                               | The default transaction access mode for the current session. If set to `on`, only read operations are allowed in transactions in the current session; if set to `off`, both read and write operations are allowed. See <InternalLink path="set-transaction">`SET TRANSACTION`</InternalLink> for more details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `default\_transaction\_use\_follower\_reads`                     | If set to on, all read-only transactions use <InternalLink path="as-of-system-time">`AS OF SYSTEM TIME follower\_read\_timestamp()`</InternalLink> to allow the transaction to use follower reads. If set to `off`, read-only transactions will only use follower reads if an `AS OF SYSTEM TIME` clause is specified in the statement, with an interval of at least 4.8 seconds.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `disable\_changefeed\_replication`                               | When `true`, <InternalLink path="changefeed-messages#filtering-changefeed-messages">changefeeds</InternalLink> will not emit messages for any changes (e.g., `INSERT`, `UPDATE`) issued to watched tables during that session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `false`                                                                                                                                                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `disallow\_full\_table\_scans`                                   | If set to `on`, queries on "large" tables with a row count greater than [`large\_full\_scan\_rows`](#large-full-scan-rows) will not use full table or index scans. If no other query plan is possible, queries will return an error message. This setting does not apply to internal queries, which may plan full table or index scans without checking the session variable.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| <a id="distsql" />                                               | `distsql`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | The query distribution mode for the session. By default, CockroachDB determines which queries are faster to execute if distributed across multiple nodes, and all other queries are run through the gateway node.                   | `auto`                                                                                                                                          | Yes                                                             | Yes |
| `enable\_auto\_rehoming`                                         | When enabled, the <InternalLink path="alter-table">home regions</InternalLink> of rows in <InternalLink path="alter-table#set-the-table-locality-to-regional-by-row">`REGIONAL BY ROW`</InternalLink> tables are automatically set to the region of the <InternalLink path="ui-sessions-page">gateway node</InternalLink> from which any <InternalLink path="update">`UPDATE`</InternalLink> or <InternalLink path="upsert">`UPSERT`</InternalLink> statements that operate on those rows originate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_create\_stats\_using\_extremes`                         | If `on`, allows manual creation of partial statistics using the <InternalLink path="create-statistics#create-partial-statistics-using-extremes">`CREATE STATISTICS ... USING EXTREMES`</InternalLink> syntax.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_durable\_locking\_for\_serializable`                    | Indicates whether CockroachDB replicates <InternalLink path="select-for-update#lock-strengths">`FOR UPDATE` and `FOR SHARE`</InternalLink> locks via <InternalLink path="architecture/replication-layer#raft">Raft</InternalLink>, allowing locks to be preserved when leases are transferred. Note that replicating `FOR UPDATE` and `FOR SHARE` locks will add latency to those statements. This setting only affects `SERIALIZABLE` transactions and matches the default `READ COMMITTED` behavior when enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                        | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_experimental\_alter\_column\_type\_general`             | If `on`, it is possible to <InternalLink path="alter-table#alter-column-data-types">alter column data types</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_implicit\_fk\_locking\_for\_serializable`               | Indicates whether CockroachDB uses <InternalLink path="select-for-update#lock-strengths">shared locks</InternalLink> to perform <InternalLink path="foreign-key">foreign key</InternalLink> checks. To take effect, the [`enable\_shared\_locking\_for\_serializable`](#enable-shared-locking-for-serializable) setting must also be enabled. This setting only affects `SERIALIZABLE` transactions and matches the default `READ COMMITTED` behavior when enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_implicit\_select\_for\_update`                          | Indicates whether <InternalLink path="update">`UPDATE`</InternalLink> and <InternalLink path="upsert">`UPSERT`</InternalLink> statements acquire locks using the `FOR UPDATE` locking mode during their initial row scan, which improves performance for contended workloads.  For more information about how `FOR UPDATE` locking works, see the documentation for <InternalLink path="select-for-update">`SELECT FOR UPDATE`</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_implicit\_transaction\_for\_batch\_statements`          | Indicates whether multiple statements in a single query (a "batch statement") will all run in the same implicit transaction, which matches the PostgreSQL wire protocol.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_insert\_fast\_path`                                     | Indicates whether CockroachDB will use a specialized execution operator for inserting into a table. We recommend leaving this setting `on`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_shared\_locking\_for\_serializable`                     | Indicates whether <InternalLink path="select-for-update#lock-strengths">shared locks</InternalLink> are enabled for `SERIALIZABLE` transactions. When `off`, `SELECT` statements using `FOR SHARE` are still permitted under `SERIALIZABLE` isolation, but silently do not lock.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_super\_regions`                                         | When enabled, you can define a super region: a set of <InternalLink path="multiregion-overview#super-regions">database regions</InternalLink> on a multi-region cluster such that your <InternalLink path="schema-design-overview#database-schema-objects">schema objects</InternalLink> will have all of their <InternalLink path="architecture/overview">replicas</InternalLink> stored *only* in regions that are members of the super region.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enable\_zigzag\_join`                                           | Indicates whether the <InternalLink path="cost-based-optimizer">cost-based optimizer</InternalLink> will plan certain queries using a <InternalLink path="cost-based-optimizer#zigzag-joins">zigzag merge join algorithm</InternalLink>, which searches for the desired intersection by jumping back and forth between the indexes based on the fact that after constraining indexes, they share an ordering.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `enforce\_home\_region`                                          | If set to `on`, queries return an error and in some cases a suggested resolution if they cannot run entirely in their home region. This can occur if a query has no home region (for example, if it reads from different home regions in a <InternalLink path="table-localities#regional-by-row-tables">regional by row table</InternalLink>) or a query's home region differs from the <InternalLink path="architecture/life-of-a-distributed-transaction#gateway">gateway</InternalLink> region. Note that only tables with `ZONE`<InternalLink path="multiregion-survival-goals#when-to-use-zone-vs-region-survival-goals">survivability</InternalLink> can be scanned without error when this is enabled. For more information about home regions, see <InternalLink path="multiregion-overview#table-localities">Table localities</InternalLink>.  This feature is in preview. It is subject to change.                                                               | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `enforce\_home\_region\_follower\_reads\_enabled`                | If `on` while the <InternalLink path="cost-based-optimizer#control-whether-queries-are-limited-to-a-single-region">`enforce\_home\_region`</InternalLink> setting is `on`, allows `enforce\_home\_region` to perform `AS OF SYSTEM TIME`<InternalLink path="follower-reads">follower reads</InternalLink> to detect and report a query's <InternalLink path="multiregion-overview#table-localities">home region</InternalLink>, if any.  This feature is in preview. It is subject to change.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `expect\_and\_ignore\_not\_visible\_columns\_in\_copy`           | If `on`, <InternalLink path="copy">`COPY FROM`</InternalLink> with no column specifiers will assume that hidden columns are in the copy data, but will ignore them when applying `COPY FROM`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `extra\_float\_digits`                                           | The number of digits displayed for floating-point values. Only values between `-15` and `3` are supported.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `0`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `force\_savepoint\_restart`                                      | When set to `true`, allows the <InternalLink path="savepoint">`SAVEPOINT`</InternalLink> statement to accept any name for a savepoint.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `foreign\_key\_cascades\_limit`                                  | Limits the number of <InternalLink path="foreign-key#use-a-foreign-key-constraint-with-cascade">cascading operations</InternalLink> that run as part of a single query.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `10000`                                                                                                                                                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `idle\_in\_session\_timeout`                                     | Automatically terminates sessions that idle past the specified threshold.  When set to `0`, the session will not timeout.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | The value set by the `sql.defaults.idle\_in\_session\_timeout`<InternalLink path="cluster-settings">cluster setting</InternalLink> (`0s`, by default).                                                                              | Yes                                                                                                                                             | Yes                                                             |     |
| `idle\_in\_transaction\_session\_timeout`                        | Automatically terminates sessions that are idle in a transaction past the specified threshold.  When set to `0`, the session will not timeout.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | The value set by the `sql.defaults.idle\_in\_transaction\_session\_timeout`<InternalLink path="cluster-settings">cluster setting</InternalLink> (0s, by default).                                                                   | Yes                                                                                                                                             | Yes                                                             |     |
| `index\_recommendations\_enabled`                                | If `true`, display recommendations to create indexes required to eliminate full table scans. For more details, see <InternalLink path="explain#default-statement-plans">Default statement plans</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | `true`                                                                                                                                                                                                                              | Yes                                                                                                                                             | Yes                                                             |     |
| `inject\_retry\_errors\_enabled`                                 | If `true`, any statement executed inside of an explicit transaction (with the exception of <InternalLink path="set-vars">`SET`</InternalLink> statements) will return a transaction retry error. If the client retries the transaction using the special <InternalLink path="savepoint#savepoints-for-client-side-transaction-retries">`cockroach\_restart SAVEPOINT` name</InternalLink>, after the 3rd retry error, the transaction will proceed as normal. Otherwise, the errors will continue until `inject\_retry\_errors\_enabled` is set to `false`. For more details, see <InternalLink path="transaction-retry-error-example#test-transaction-retry-logic">Test transaction retry logic</InternalLink>.                                                                                                                                                                                                                                                           | `false`                                                                                                                                                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| <a id="intervalstyle" />                                         | `intervalstyle`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | The input string format for <InternalLink path="interval">`INTERVAL`</InternalLink> values. Accepted values include `postgres`, `iso\_8601`, and `sql\_standard`.                                                                   | The value set by the `sql.defaults.intervalstyle`<InternalLink path="cluster-settings">cluster setting</InternalLink> (`postgres`, by default). | Yes                                                             | Yes |
| `is\_superuser`                                                  | If `on` or `true`, the current user is a member of the <InternalLink path="security-reference/authorization#admin-role">`admin` role</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | User-dependent                                                                                                                                                                                                                      | No                                                                                                                                              | Yes                                                             |     |
| `large\_full\_scan\_rows`                                        | Determines which tables are considered "large" such that `disallow\_full\_table\_scans` prevents queries from performing full table or index scans on those tables. The default value is `1000`. To prevent all full table or index scans, set to `0`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | User-dependent                                                                                                                                                                                                                      | No                                                                                                                                              | Yes                                                             |     |
| `legacy\_varchar\_typing`                                        | **New in v23.2.18:** If `on`, type checking and overload resolution for <InternalLink path="string#related-types">`VARCHAR`</InternalLink> types ignore overloads that cause errors, allowing comparisons between `VARCHAR` and non-`STRING`-like placeholder values to execute successfully. If `off`, type checking of these comparisons is more strict and must be handled with explicit type casts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `locality`                                                       | The location of the node. For more information, see <InternalLink path="cockroach-start#locality">Locality</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Node-dependent                                                                                                                                                                                                                      | No                                                                                                                                              | Yes                                                             |     |
| `lock\_timeout`                                                  | The amount of time a query can spend acquiring or waiting for a single <InternalLink path="architecture/transaction-layer#concurrency-control">row-level lock</InternalLink>. In CockroachDB, unlike in PostgreSQL, non-locking reads wait for conflicting locks to be released. As a result, the `lock\_timeout` configuration applies to writes, and to locking and non-locking reads in read-write and read-only transactions. If `lock\_timeout = 0`, queries do not timeout due to lock acquisitions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | The value set by the `sql.defaults.lock\_timeout`<InternalLink path="cluster-settings">cluster setting</InternalLink> (`0`, by default)                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `multiple\_active\_portals\_enabled`                             | Whether to enable the <InternalLink path="postgresql-compatibility#multiple-active-portals">multiple active portals</InternalLink> pgwire feature.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | `false`                                                                                                                                                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `node\_id`                                                       | The ID of the node currently connected to.  This variable is particularly useful for verifying load balanced connections.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Node-dependent                                                                                                                                                                                                                      | No                                                                                                                                              | Yes                                                             |     |
| `null\_ordered\_last`                                            | Set the default ordering of `NULL`s. The default order is `NULL`s first for ascending order and `NULL`s last for descending order.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | `false`                                                                                                                                                                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `optimizer\_push\_offset\_into\_index\_join`                     | If `on`, the optimizer will attempt to push offset expressions into index join expressions to produce more efficient query plans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `optimizer\_use\_forecasts`                                      | If `on`, the optimizer uses forecasted statistics for query planning.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `optimizer\_use\_histograms`                                     | If `on`, the optimizer uses collected histograms for cardinality estimation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `on`                                                                                                                                                                                                                                | No                                                                                                                                              | Yes                                                             |     |
| `optimizer\_use\_improved\_multi\_column\_selectivity\_estimate` | If `on`, the optimizer uses an improved selectivity estimate for multi-column predicates.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `optimizer\_use\_improved\_zigzag\_join\_costing`                | If `on`, the cost of <InternalLink path="cost-based-optimizer#zigzag-joins">zigzag joins</InternalLink> is updated so they will be never be chosen over scans unless they produce fewer rows. To take effect, the [`enable\_zigzag\_join`](#enable-zigzag-join) setting must also be enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| `optimizer\_use\_lock\_op\_for\_serializable`                    | If `on`, the optimizer uses a `Lock` operator to construct query plans for `SELECT` statements using the <InternalLink path="select-for-update">`FOR UPDATE` and `FOR SHARE`</InternalLink> clauses. This setting only affects `SERIALIZABLE` transactions. `READ COMMITTED` transactions are evaluated with the `Lock` operator regardless of the setting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `optimizer\_use\_multicol\_stats`                                | If `on`, the optimizer uses collected multi-column statistics for cardinality estimation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `on`                                                                                                                                                                                                                                | No                                                                                                                                              | Yes                                                             |     |
| `optimizer\_use\_not\_visible\_indexes`                          | If `on`, the optimizer uses not visible indexes for planning.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `off`                                                                                                                                                                                                                               | No                                                                                                                                              | Yes                                                             |     |
| `pg\_trgm.similarity\_threshold`                                 | The threshold above which a <InternalLink path="functions-and-operators#operators">`%`</InternalLink> string comparison returns `true`. The value must be between `0` and `1`. For more information, see <InternalLink path="trigram-indexes">Trigram Indexes</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `0.3`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `plan\_cache\_mode`                                              | The type of plan that is cached in the <InternalLink path="cost-based-optimizer#query-plan-cache">query plan cache</InternalLink>: `auto`, `force\_generic\_plan`, or `force\_custom\_plan`.  For more information, refer to <InternalLink path="cost-based-optimizer#query-plan-type">Query plan type</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | `force\_custom\_plan`                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `prefer\_lookup\_joins\_for\_fks`                                | If `on`, the optimizer prefers <InternalLink path="joins#lookup-joins">`lookup joins`</InternalLink> to <InternalLink path="joins#merge-joins">`merge joins`</InternalLink> when performing <InternalLink path="foreign-key">`foreign key`</InternalLink> checks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `reorder\_joins\_limit`                                          | Maximum number of joins that the optimizer will attempt to reorder when searching for an optimal query execution plan.  For more information, see <InternalLink path="cost-based-optimizer#join-reordering">Join reordering</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `8`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `require\_explicit\_primary\_keys`                               | If `on`, CockroachDB throws an error for all tables created without an explicit primary key defined.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `search\_path`                                                   | A list of schemas that will be searched to resolve unqualified table or function names. For more details, see <InternalLink path="sql-name-resolution">SQL name resolution</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | `public`                                                                                                                                                                                                                            | Yes                                                                                                                                             | Yes                                                             |     |
| `serial\_normalization`                                          | Specifies the default handling of <InternalLink path="serial">`SERIAL`</InternalLink> in table definitions. Valid options include `'rowid'`, `'virtual\_sequence'`, `sql\_sequence`, `sql\_sequence\_cached`, and `unordered\_rowid`. If set to `'virtual\_sequence'`, the `SERIAL` type auto-creates a sequence for [better compatibility with Hibernate sequences](https://forum.cockroachlabs.com/t/hibernate-sequence-generator-returns-negative-number-and-ignore-unique-rowid/1885). If set to `sql\_sequence\_cached`, you can use the `sql.defaults.serial\_sequences\_cache\_size`<InternalLink path="cluster-settings">cluster setting</InternalLink> to control the number of values to cache in a user's session, with a default of 256. If set to `unordered\_rowid`, the `SERIAL` type generates a globally unique 64-bit integer (a combination of the insert timestamp and the ID of the node executing the statement) that does not have unique ordering. | `'rowid'`                                                                                                                                                                                                                           | Yes                                                                                                                                             | Yes                                                             |     |
| `server\_version`                                                | The version of PostgreSQL that CockroachDB emulates.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Version-dependent                                                                                                                                                                                                                   | No                                                                                                                                              | Yes                                                             |     |
| `server\_version\_num`                                           | The version of PostgreSQL that CockroachDB emulates.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Version-dependent                                                                                                                                                                                                                   | Yes                                                                                                                                             | Yes                                                             |     |
| `session\_id`                                                    | The ID of the current session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Session-dependent                                                                                                                                                                                                                   | No                                                                                                                                              | Yes                                                             |     |
| `session\_user`                                                  | The user connected for the current session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | User in connection string                                                                                                                                                                                                           | No                                                                                                                                              | Yes                                                             |     |
| `sql\_safe\_updates`                                             | If `false`, potentially unsafe SQL statements are allowed, including `DROP` of a non-empty database and all dependent objects, <InternalLink path="delete">`DELETE`</InternalLink> without a `WHERE` clause, <InternalLink path="update">`UPDATE`</InternalLink> without a `WHERE` clause, and <InternalLink path="alter-table#drop-column">`ALTER TABLE .. DROP COLUMN`</InternalLink>. See <InternalLink path="cockroach-sql#allow-potentially-unsafe-sql-statements">Allow Potentially Unsafe SQL Statements</InternalLink> for more details.                                                                                                                                                                                                                                                                                                                                                                                                                           | `true` for interactive sessions from the <InternalLink path="cockroach-sql">built-in SQL client</InternalLink>, `false` for sessions from other clients                                                                             | Yes                                                                                                                                             | Yes                                                             |     |
| `statement\_timeout`                                             | The amount of time a statement can run before being stopped. This value can be an `int` (e.g., `10`) and will be interpreted as milliseconds. It can also be an interval or string argument, where the string can be parsed as a valid interval (e.g., `'4s'`). A value of `0` turns it off.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | The value set by the `sql.defaults.statement\_timeout`<InternalLink path="cluster-settings">cluster setting</InternalLink> (`0s`, by default).                                                                                      | Yes                                                                                                                                             | Yes                                                             |     |
| `stub\_catalog\_tables`                                          | If `off`, querying an unimplemented, empty <InternalLink path="pg-catalog">`pg\_catalog`</InternalLink> table will result in an error, as is the case in v20.2 and earlier. If `on`, querying an unimplemented, empty `pg\_catalog` table simply returns no rows.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| <a id="timezone" />                                              | `timezone`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | The default time zone for the current session. This session variable was named `"time zone"` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL.                                              | `UTC`                                                                                                                                           | Yes                                                             | Yes |
| <a id="tracing" />                                               | `tracing`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | The trace recording state.                                                                                                                                                                                                          | `off`                                                                                                                                           |                                                                 | Yes |
| `transaction\_isolation`                                         | The isolation level at which the transaction executes (<InternalLink path="demo-serializable">`SERIALIZABLE`</InternalLink> or <InternalLink path="read-committed">`READ COMMITTED`</InternalLink>). See <InternalLink path="transactions#isolation-levels">Isolation levels</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `SERIALIZABLE`                                                                                                                                                                                                                      | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_priority`                                          | The priority of the current transaction. See Transactions: Transaction priorities for more details. This session variable was called transaction priority (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | `NORMAL`                                                                                                                                                                                                                            | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_read\_only`                                        | The access mode of the current transaction. See <InternalLink path="set-transaction">`SET TRANSACTION`</InternalLink> for more details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_rows\_read\_err`                                   | The limit for the number of rows read by a SQL transaction. If this value is exceeded the transaction will fail (or the event will be logged to `SQL\_INTERNAL\_PERF` for internal transactions).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `0`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_rows\_read\_log`                                   | The threshold for the number of rows read by a SQL transaction. If this value is exceeded, the event will be logged to `SQL\_PERF` (or `SQL\_INTERNAL\_PERF` for internal transactions).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | `0`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_rows\_written\_err`                                | The limit for the number of rows written by a SQL transaction. If this value is exceeded the transaction will fail (or the event will be logged to `SQL\_INTERNAL\_PERF` for internal transactions).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | `0`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_rows\_written\_log`                                | The threshold for the number of rows written by a SQL transaction. If this value is exceeded, the event will be logged to `SQL\_PERF` (or `SQL\_INTERNAL\_PERF` for internal transactions).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `0`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `transaction\_status`                                            | The state of the current transaction. See <InternalLink path="transactions">Transactions</InternalLink> for more details. This session variable was called `transaction status` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `NoTxn`                                                                                                                                                                                                                             | No                                                                                                                                              | Yes                                                             |     |
| `transaction\_timeout`                                           | Aborts an explicit <InternalLink path="transactions">transaction</InternalLink> when it runs longer than the configured duration. Stored in milliseconds; can be expressed in milliseconds or as an <InternalLink path="interval">`INTERVAL`</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `0`                                                                                                                                                                                                                                 | Yes                                                                                                                                             | Yes                                                             |     |
| `troubleshooting\_mode\_enabled`                                 | When enabled, avoid performing additional work on queries, such as collecting and emitting telemetry data. This session variable is particularly useful when the cluster is experiencing issues, unavailability, or failure.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `off`                                                                                                                                                                                                                               | Yes                                                                                                                                             | Yes                                                             |     |
| `use\_declarative\_schema\_changer`                              | Whether to use the declarative schema changer for supported statements.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `on`                                                                                                                                                                                                                                | Yes                                                                                                                                             | Yes                                                             |     |
| <a id="vectorize" />                                             | `vectorize`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | The vectorized execution engine mode. Options include `on` and `off`. For more details, see <InternalLink path="vectorized-execution#configure-vectorized-execution">Configure vectorized execution for CockroachDB</InternalLink>. | `on`                                                                                                                                            | Yes                                                             | Yes |
| `virtual\_cluster\_name`                                         | The name of the virtual cluster that the SQL client is connected to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Session-dependent                                                                                                                                                                                                                   | No                                                                                                                                              | Yes                                                             |     |

The following session variables are exposed only for backwards compatibility with earlier CockroachDB releases and have no impact on how CockroachDB runs:

| Variable name                                  | Initial value    | Modify with <InternalLink path="set-vars">`SET`</InternalLink>? | View with <InternalLink path="show-vars">`SHOW`</InternalLink>? |
| ---------------------------------------------- | ---------------- | --------------------------------------------------------------- | --------------------------------------------------------------- |
| `backslash\_quote`                             | `safe\_encoding` | No                                                              | Yes                                                             |
| `client\_encoding`                             | `UTF8`           | No                                                              | Yes                                                             |
| `default\_tablespace`                          |                  | No                                                              | Yes                                                             |
| `enable\_drop\_enum\_value`                    | `off`            | Yes                                                             | Yes                                                             |
| `enable\_seqscan`                              | `on`             | Yes                                                             | Yes                                                             |
| `escape\_string\_warning`                      | `on`             | No                                                              | Yes                                                             |
| `experimental\_enable\_hash\_sharded\_indexes` | `off`            | Yes                                                             | Yes                                                             |
| `integer\_datetimes`                           | `on`             | No                                                              | Yes                                                             |
| `max\_identifier\_length`                      | `128`            | No                                                              | Yes                                                             |
| `max\_index\_keys`                             | `32`             | No                                                              | Yes                                                             |
| `row\_security`                                | `off`            | No                                                              | Yes                                                             |
| `standard\_conforming\_strings`                | `on`             | No                                                              | Yes                                                             |
| `server\_encoding`                             | `UTF8`           | Yes                                                             | Yes                                                             |
| `synchronize\_seqscans`                        | `on`             | No                                                              | Yes                                                             |
| `synchronous\_commit`                          | `on`             | Yes                                                             | Yes                                                             |

For session variables on features in preview, see <InternalLink path="cockroachdb-feature-availability">Features in Preview</InternalLink>.

Special syntax cases supported for compatibility:

| Syntax                             | Equivalent to                        |
| ---------------------------------- | ------------------------------------ |
| `SHOW TRANSACTION PRIORITY`        | `SHOW "transaction priority"`        |
| `SHOW TRANSACTION ISOLATION LEVEL` | `SHOW "transaction isolation level"` |
| `SHOW TIME ZONE`                   | `SHOW "timezone"`                    |
| `SHOW TRANSACTION STATUS`          | `SHOW "transaction status"`          |

## Examples

### Showing the value of a single session variable

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW DATABASE;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
  database
------------
  movr
(1 row)
```

### Showing the value of all session variables

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW ALL;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
       variable       |      value
----------------------+-------------------
  application_name    | $ cockroach demo
  bytea_output        | hex
  client_encoding     | UTF8
  client_min_messages | notice
...
```

## See also

* <InternalLink path="set-vars">`SET session variable`</InternalLink>
* <InternalLink path="transactions">Transactions</InternalLink>, including <InternalLink path="transactions#transaction-priorities">Priority levels</InternalLink>
* <InternalLink path="show-cluster-setting">`SHOW CLUSTER SETTING`</InternalLink>
* <InternalLink path="show-columns">`SHOW COLUMNS`</InternalLink>
* <InternalLink path="show-constraints">`SHOW CONSTRAINTS`</InternalLink>
* <InternalLink path="show-create">`SHOW CREATE`</InternalLink>
* <InternalLink path="show-databases">`SHOW DATABASES`</InternalLink>
* <InternalLink path="show-grants">`SHOW GRANTS`</InternalLink>
* <InternalLink path="show-index">`SHOW INDEX`</InternalLink>
* <InternalLink path="show-users">`SHOW USERS`</InternalLink>
