SHOW (session settings)

The SHOW statement can display the value of either one or all ofthe session setting variables. Some of these can also be configured via SET.

Required privileges

No privileges are required to display the session settings.

Synopsis

SHOWSESSIONvar_nameALL

Note:
The SHOW statement for session settings is unrelated to the other SHOW statements: SHOW CLUSTER SETTING, SHOW CREATE, SHOW USERS, SHOW DATABASES, SHOW COLUMNS, SHOW GRANTS, and SHOW CONSTRAINTS.

Parameters

The SHOW <session variable> statement accepts a single parameter: the variable name.

The variable name is case insensitive. It may be enclosed in double quotes; this is useful if the variable name itself contains spaces.

Supported variables

Variable nameDescriptionInitial valueModify with SET ?View with SHOW ?
application_name The current application name for statistics collection.Empty string, or cockroach for sessions from the built-in SQL client.YesYes
bytea_output The mode for conversions from STRING to BYTES.hexYesYes
database The current database.Database in connection string, or empty if not specified.YesYes
default_int_size The size, in bytes, of an INT type. 8 YesYes
default_transaction_isolation All transactions execute with SERIALIZABLE isolation. See Transactions: Isolation levels. SERIALIZABLE NoYes
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 SET TRANSACTION for more details. off YesYes
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 YesYes
extra_float_digits The number of digits displayed for floating-point values. Only values between -15 and 3 are supported. 0 YesYes
experimental_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 Join reordering. 4 YesYes
force_savepoint_restartWhen set to true, allows the SAVEPOINT statement to accept any name for a savepoint. off YesYes
node_id The ID of the node currently connected to.This variable is particularly useful for verifying load balanced connections.Node-dependentNoYes
optimizer The mode in which a query execution plan is generated. If set to on, the cost-based optimizer is enabled by default and the heuristic planner will only be used if the query is not supported by the cost-based optimizer; if set to off, all queries are run through the legacy heuristic planner. on YesYes
results_buffer_size The default size of the buffer that accumulates results for a statement or a batch of statements before they are sent to the client. This can also be set for all connections using the 'sql.defaults.results_buffer_size' cluster setting. Note that auto-retries generally only happen while no results have been delivered to the client, so reducing this size can increase the number of retriable errors a client receives. On the other hand, increasing the buffer size can increase the delay until the client receives the first result row. Setting to 0 disables any buffering. 16384 YesYes
search_path A list of schemas that will be searched to resolve unqualified table or function names. For more details, see SQL name resolution. public YesYes
server_version The version of PostgreSQL that CockroachDB emulates.Version-dependentNoYes
server_version_num The version of PostgreSQL that CockroachDB emulates.Version-dependentYesYes
session_user The user connected for the current session.User in connection stringNoYes
sql_safe_updates If false, potentially unsafe SQL statements are allowed, including DROP of a non-empty database and all dependent objects, DELETE without a WHERE clause, UPDATE without a WHERE clause, and ALTER TABLE .. DROP COLUMN. See Allow Potentially Unsafe SQL Statements for more details. true for interactive sessions from the built-in SQL client,false for sessions from other clientsYesYes
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. 0s YesYes
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 YesYes
tracing The trace recording state. off Yes
transaction_isolation All transactions execute with SERIALIZABLE isolation. See Transactions: Isolation levels. This session variable was called transaction isolation level (with spaces) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. SERIALIZABLE NoYes
transaction_priority The priority of the current transaction. See Transactions: Isolation levels 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 YesYes
transaction_read_only The access mode of the current transaction. See Set Transaction for more details. off YesYes
transaction_status The state of the current transaction. See Transactions 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 NoYes
client_encoding (Reserved; exposed only for ORM compatibility.) UTF8 NoYes
client_min_messages (Reserved; exposed only for ORM compatibility.) notice NoYes
datestyle (Reserved; exposed only for ORM compatibility.) ISO NoYes
integer_datetimes (Reserved; exposed only for ORM compatibility.) on NoYes
intervalstyle (Reserved; exposed only for ORM compatibility.) postgres NoYes
max_index_keys (Reserved; exposed only for ORM compatibility.) 32 NoYes
standard_conforming_strings (Reserved; exposed only for ORM compatibility.) on NoYes
server_encoding (Reserved; exposed only for ORM compatibility.) UTF8 YesYes

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

  1. > SHOW DATABASE;
  1. +----------+
  2. | database |
  3. +----------+
  4. | test |
  5. +----------+
  6. (1 row)

Showing the value of all session variables

  1. > SHOW ALL;
  1. +--------------------------------+----------------+
  2. | variable | value |
  3. +--------------------------------+----------------+
  4. | application_name | cockroach demo |
  5. | bytea_output | hex |
  6. | client_encoding | UTF8 |
  7. | client_min_messages | notice |
  8. | database | defaultdb |
  9. | datestyle | ISO |
  10. | default_transaction_isolation | serializable |
  11. | default_transaction_read_only | off |
  12. | distsql | auto |
  13. | experimental_enable_zigzag_join | off |
  14. | experimental_opt | on |
  15. | extra_float_digits | 0 |
  16. | integer_datetimes | on |
  17. | intervalstyle | postgres |
  18. | max_index_keys | 32 |
  19. | node_id | 1 |
  20. | search_path | public |
  21. | server_encoding | UTF8 |
  22. | server_version | 9.5.0 |
  23. | server_version_num | 90500 |
  24. | session_user | root |
  25. | sql_safe_updates | true |
  26. | standard_conforming_strings | on |
  27. | statement_timeout | 0s |
  28. | timezone | UTC |
  29. | tracing | off |
  30. | transaction_isolation | serializable |
  31. | transaction_priority | normal |
  32. | transaction_read_only | off |
  33. | transaction_status | NoTxn |
  34. +--------------------------------+----------------+
  35. (31 rows)

See also

Was this page helpful?
YesNo