Skip to main content
Use the SHOW to display the value of one or all of the session variables. You configure session variables using .

Required privileges

No are required to display the session variables.

Synopsis

show_session syntax diagram
The SHOW statement for session variables is unrelated to the other SHOW statements like , , and .

Parameters

ParameterDescription
var\_nameThe session variable name to show. The variable name is case-insensitive and can be enclosed in double quotes.

Supported variables

Variable nameDescriptionInitial valueModify with ?View with ?
always\_distribute\_full\_scansWhen set to on, full table scans are always .offYesYes
application\_nameThe current application name for statistics collection.Empty string, or cockroach for sessions from the .YesYes
autocommit\_before\_ddlWhen the is set to on, any schema change statement that is sent during an will cause the transaction to before executing the schema change. This is useful because . : This setting is enabled by default. To disable it for , issue the following statement: ALTER ROLE ALL SET autocommit\_before\_ddl = falseonYesYes
bytea\_outputThe .hexYesYes
client\_min\_messagesThe severity level of notices displayed in the . Accepted values include debug5, debug4, debug3, debug2, debug1, log, notice, warning, and error.noticeYesYes
copy\_from\_atomic\_enabledIf set to on, 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.onYesYes
copy\_transaction\_quality\_of\_serviceThe default quality of service for statements in the current session. The supported options are regular, critical, and background. See .backgroundYesYes
cost\_scans\_with\_default\_col\_sizeWhether to prevent the optimizer from considering column size when costing plans.falseYesYes
crdb\_versionThe version of CockroachDB.CockroachDB OSS versionNoYes
databaseThe .Database in connection string, or empty if not specified.YesYes
datestyleThe input string format for and values. Accepted values include ISO,MDY, ISO,DMY, and ISO,YMD.The value set by the sql.defaults.datestyle (ISO,MDY, by default).YesYes
default\_int\_sizeThe size, in bytes, of an type.8YesYes
default\_text\_search\_configThe dictionary used to normalize tokens and eliminate stop words when calling a without a configuration parameter. See .englishYesYes
default\_transaction\_isolationThe isolation level at which transactions in the session execute ( or ). See .SERIALIZABLEYesYes
default\_transaction\_priorityThe default transaction priority for the current session. The supported options are low, normal, and high.normalYesYes
default\_transaction\_quality\_of\_serviceThe default transaction quality of service for the current session. The supported options are regular, critical, and background. See .regularYesYes
default\_transaction\_read\_onlyThe 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 for more details.offYesYes
default\_transaction\_use\_follower\_readsIf set to on, all read-only transactions use 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.offYesYes
disable\_changefeed\_replicationWhen true, will not emit messages for any changes (e.g., INSERT, UPDATE) issued to watched tables during that session.falseYesYes
disallow\_full\_table\_scansIf set to on, queries on “large” tables with a row count greater than 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.offYesYes
distribute\_group\_by\_row\_count\_thresholdMinimum number of rows that a GROUP BY operation must process in order to be .1000YesYes
distribute\_scan\_row\_count\_thresholdMinimum number of rows that a scan operation must process in order to be . This means that full table scans will not be distributed if they read fewer than this number of rows. To always distribute full table scans, set always\_distribute\_full\_scans.10000YesYes
distribute\_sort\_row\_count\_thresholdMinimum number of rows that a sort operation must process in order to be .1000YesYes
distsqlThe query distribution mode for the session. By default, CockroachDB determines which queries are faster to execute if distributed across multiple nodes. Distribution preferences for GROUP BY, scan, and sort operations are set with distribute\_group\_by\_row\_count\_threshold, distribute\_scan\_row\_count\_threshold. and distribute\_sort\_row\_count\_threshold., respectively. All other queries are run through the gateway node.autoYesYes
enable\_auto\_rehomingWhen enabled, the of rows in tables are automatically set to the region of the from which any or statements that operate on those rows originate.offYesYes
enable\_create\_stats\_using\_extremesIf on, allows manual creation of using the syntax.onYesYes
enable\_durable\_locking\_for\_serializableIndicates whether CockroachDB replicates locks via , 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.offYesYes
enable\_implicit\_fk\_locking\_for\_serializableIndicates whether CockroachDB uses to perform checks. To take effect, the 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.offYesYes
enable\_implicit\_select\_for\_updateIndicates whether , , and 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 .onYesYes
enable\_implicit\_transaction\_for\_batch\_statementsIndicates whether multiple statements in a single query (a “batch statement”) will all run in the same implicit transaction, which matches the PostgreSQL wire protocol.onYesYes
enable\_insert\_fast\_pathIndicates whether CockroachDB will use a specialized execution operator for inserting into a table. We recommend leaving this setting on.onYesYes
enable\_shared\_locking\_for\_serializableIndicates whether are enabled for SERIALIZABLE transactions. When off, SELECT statements using FOR SHARE are still permitted under SERIALIZABLE isolation, but silently do not lock.offYesYes
enable\_super\_regionsWhen enabled, you can define a super region: a set of on a multi-region cluster such that your will have all of their stored only in regions that are members of the super region.offYesYes
enable\_zigzag\_joinIndicates whether the will plan certain queries using a , 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.onYesYes
enforce\_home\_regionIf 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 ) or a query’s home region differs from the region. Note that only tables with ZONE can be scanned without error when this is enabled. For more information about home regions, see . This feature is in preview. It is subject to change.offYesYes
enforce\_home\_region\_follower\_reads\_enabledIf on while the setting is on, allows enforce\_home\_region to perform AS OF SYSTEM TIME to detect and report a query’s , if any. This feature is in preview. It is subject to change.offYesYes
expect\_and\_ignore\_not\_visible\_columns\_in\_copyIf on, with no column specifiers will assume that hidden columns are in the copy data, but will ignore them when applying COPY FROM.offYesYes
extra\_float\_digitsThe number of digits displayed for floating-point values. Only values between -15 and 3 are supported.0YesYes
force\_savepoint\_restartWhen set to true, allows the statement to accept any name for a savepoint.offYesYes
foreign\_key\_cascades\_limitLimits the number of that run as part of a single query.10000YesYes
idle\_in\_session\_timeoutAutomatically 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 (0s, by default).YesYes
idle\_in\_transaction\_session\_timeoutAutomatically 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 (0s, by default).YesYes
index\_recommendations\_enabledIf true, display recommendations to create indexes required to eliminate full table scans. For more details, see .trueYesYes
inject\_retry\_errors\_enabledIf true, any statement executed inside of an explicit transaction (with the exception of statements) will return a transaction retry error. If the client retries the transaction using the special , 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 .falseYesYes
intervalstyleThe input string format for values. Accepted values include postgres, iso\_8601, and sql\_standard.The value set by the sql.defaults.intervalstyle (postgres, by default).YesYes
is\_superuserIf on or true, the current user is a member of the .User-dependentNoYes
large\_full\_scan\_rowsDetermines which tables are considered “large” such that disallow\_full\_table\_scans rejects full table or index scans of “large” tables. The default value is 0, which disallows all full table or index scans.User-dependentNoYes
legacy\_varchar\_typingIf on, type checking and overload resolution for 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.offYesYes
localityThe location of the node. For more information, see .Node-dependentNoYes
lock\_timeoutThe amount of time a query can spend acquiring or waiting for a single . 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 (0, by default)YesYes
multiple\_active\_portals\_enabledWhether to enable the pgwire feature.falseYesYes
node\_idThe ID of the node currently connected to. This variable is particularly useful for verifying load balanced connections.Node-dependentNoYes
null\_ordered\_lastSet the default ordering of NULLs. The default order is NULLs first for ascending order and NULLs last for descending order.falseYesYes
optimizer\_merge\_joins\_enabledIf on, the optimizer will explore query plans with merge joins.onYesYes
optimizer\_push\_offset\_into\_index\_joinIf on, the optimizer will attempt to push offset expressions into index join expressions to produce more efficient query plans.onYesYes
optimizer\_use\_forecastsIf on, the optimizer uses forecasted statistics for query planning.onYesYes
optimizer\_use\_histogramsIf on, the optimizer uses collected histograms for cardinality estimation.onNoYes
optimizer\_use\_improved\_multi\_column\_selectivity\_estimateIf on, the optimizer uses an improved selectivity estimate for multi-column predicates.onYesYes
optimizer\_use\_improved\_zigzag\_join\_costingIf on, the cost of is updated so they will be never be chosen over scans unless they produce fewer rows. To take effect, the enable\_zigzag\_join setting must also be enabled.onYesYes
optimizer\_use\_lock\_op\_for\_serializableIf on, the optimizer uses a Lock operator to construct query plans for SELECT statements using the clauses. This setting only affects SERIALIZABLE transactions. READ COMMITTED transactions are evaluated with the Lock operator regardless of the setting.offYesYes
optimizer\_use\_merged\_partial\_statisticsIf on, the optimizer uses merged with existing full to produce more accurate cardinality estimates.onYesYes
optimizer\_use\_multicol\_statsIf on, the optimizer uses collected multi-column statistics for cardinality estimation.onNoYes
optimizer\_use\_not\_visible\_indexesIf on, the optimizer uses not visible indexes for planning.offNoYes
optimizer\_use\_virtual\_computed\_column\_statsIf on, the optimizer uses table statistics on .onYesYes
plan\_cache\_modeThe type of plan that is cached in the : auto, force\_generic\_plan, or force\_custom\_plan. For more information, refer to .autoYesYes
plpgsql\_use\_strict\_intoIf on, PL/pgSQL behave as though the STRICT option is specified. This causes the SQL statement to error if it does not return exactly one row.offYesYes
pg\_trgm.similarity\_thresholdThe threshold above which a string comparison returns true. The value must be between 0 and 1. For more information, see .0.3YesYes
prefer\_lookup\_joins\_for\_fksIf on, the optimizer prefers to when performing checks.offYesYes
reorder\_joins\_limitMaximum number of joins that the optimizer will attempt to reorder when searching for an optimal query execution plan. For more information, see .8YesYes
require\_explicit\_primary\_keysIf on, CockroachDB throws an error for all tables created without an explicit primary key defined.offYesYes
search\_pathA list of schemas that will be searched to resolve unqualified table or function names. For more details, see .publicYesYes
serial\_normalizationSpecifies the default handling of 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. If set to sql\_sequence\_cached or sql\_sequence\_cached\_node, you can use the sql.defaults.serial\_sequences\_cache\_size 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'YesYes
server\_versionThe version of PostgreSQL that CockroachDB emulates.Version-dependentNoYes
server\_version\_numThe version of PostgreSQL that CockroachDB emulates.Version-dependentYesYes
session\_idThe ID of the current session.Session-dependentNoYes
session\_userThe user connected for the current session.User in connection stringNoYes
sql\_safe\_updatesIf true, the following potentially unsafe SQL statements are disallowed: of a non-empty database and all dependent objects; and without a WHERE clause, unless a clause is included; and without a WHERE or clause; ; and converting an existing table to using , unless a has already been added to the table. For more details, refer to .true for interactive sessions from the , false for sessions from other clientsYesYes
statement\_timeoutThe 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 (0s, by default).YesYes
stub\_catalog\_tablesIf off, querying an unimplemented, empty 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.onYesYes
timezoneThe default time zone for the current session.UTCYesYes
tracingThe trace recording state.offYesYes
transaction\_isolationThe isolation level at which the transaction executes ( or ). See .SERIALIZABLEYesYes
transaction\_priorityThe 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.NORMALYesYes
transaction\_read\_onlyThe access mode of the current transaction. See for more details.offYesYes
transaction\_rows\_read\_errThe 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).0YesYes
transaction\_rows\_read\_logThe 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).0YesYes
transaction\_rows\_written\_errThe 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).0YesYes
transaction\_rows\_written\_logThe 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).0YesYes
transaction\_statusThe state of the current transaction. See for more details.NoTxnNoYes
transaction\_timeoutAborts an explicit when it runs longer than the configured duration. Stored in milliseconds; can be expressed in milliseconds or as an .0YesYes
troubleshooting\_mode\_enabledWhen 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.offYesYes
use\_declarative\_schema\_changerWhether to use the declarative schema changer for supported statements.onYesYes
vector\_search\_beam\_sizeThe size of the vector search beam, which determines how many vector partitions are considered during query execution. For details, refer to .32YesYes
vectorizeThe vectorized execution engine mode. Options include on and off. For more details, see .onYesYes
virtual\_cluster\_nameThe name of the virtual cluster that the SQL client is connected to.Session-dependentNoYes
The following session variables are exposed only for backwards compatibility with earlier CockroachDB releases and have no impact on how CockroachDB runs:
Variable nameInitial valueModify with ?View with ?
backslash\_quotesafe\_encodingNoYes
client\_encodingUTF8NoYes
default\_tablespaceNoYes
enable\_drop\_enum\_valueoffYesYes
enable\_seqscanonYesYes
escape\_string\_warningonNoYes
experimental\_enable\_hash\_sharded\_indexesoffYesYes
integer\_datetimesonNoYes
max\_identifier\_length128NoYes
max\_index\_keys32NoYes
row\_securityoffNoYes
standard\_conforming\_stringsonNoYes
server\_encodingUTF8YesYes
synchronize\_seqscansonNoYes
synchronous\_commitonYesYes
For session variables on features in preview, see . Special syntax cases supported for compatibility:
SyntaxEquivalent to
SHOW TRANSACTION PRIORITYSHOW "transaction priority"
SHOW TRANSACTION ISOLATION LEVELSHOW "transaction isolation level"
SHOW TIME ZONESHOW "timezone"
SHOW TRANSACTION STATUSSHOW "transaction status"

Examples

Showing the value of a single session variable

Showing the value of all session variables

See also

  • , including