Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _includes/sidebar-data-v2.1.json
Original file line number Diff line number Diff line change
Expand Up @@ -999,9 +999,9 @@
]
},
{
"title": "<code>SHOW TRACE</code>",
"title": "<code>SHOW TRACE FOR SESSION</code>",
"urls": [
"/${VERSION}/show-trace.html"
"/${VERSION}/show-trace-for-session.html"
]
},
{
Expand Down
56 changes: 25 additions & 31 deletions _includes/v2.1/sql/diagrams/show_trace.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
<div><svg width="696" height="80">

<polygon points="9 17 1 13 1 21"></polygon>
<polygon points="17 17 9 13 9 21"></polygon>
<rect x="31" y="3" width="62" height="32" rx="10"></rect>
<rect x="29" y="1" width="62" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="39" y="21">SHOW</text>
<rect x="133" y="35" width="86" height="32" rx="10"></rect>
<rect x="131" y="33" width="86" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="141" y="53">COMPACT</text>
<rect x="279" y="35" width="38" height="32" rx="10"></rect>
<rect x="277" y="33" width="38" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="287" y="53">KV</text>
<rect x="357" y="3" width="64" height="32" rx="10"></rect>
<rect x="355" y="1" width="64" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="365" y="21">TRACE</text>
<rect x="441" y="3" width="48" height="32" rx="10"></rect>
<rect x="439" y="1" width="48" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="449" y="21">FOR</text>
<rect x="529" y="3" width="80" height="32" rx="10"></rect>
<rect x="527" y="1" width="80" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="537" y="21">SESSION</text>
<a xlink:href="sql-grammar.html#explainable_stmt" xlink:title="explainable_stmt">
<rect x="529" y="47" width="120" height="32"></rect>
<rect x="527" y="45" width="120" height="32" class="nonterminal"></rect>
<text class="nonterminal" x="537" y="65">explainable_stmt</text>
</a>
<path class="line" d="m17 17 h2 m0 0 h10 m62 0 h10 m20 0 h10 m0 0 h96 m-126 0 h20 m106 0 h20 m-146 0 q10 0 10 10 m126 0 q0 -10 10 -10 m-136 10 v12 m126 0 v-12 m-126 12 q0 10 10 10 m106 0 q10 0 10 -10 m-116 10 h10 m86 0 h10 m40 -32 h10 m0 0 h48 m-78 0 h20 m58 0 h20 m-98 0 q10 0 10 10 m78 0 q0 -10 10 -10 m-88 10 v12 m78 0 v-12 m-78 12 q0 10 10 10 m58 0 q10 0 10 -10 m-68 10 h10 m38 0 h10 m20 -32 h10 m64 0 h10 m0 0 h10 m48 0 h10 m20 0 h10 m80 0 h10 m0 0 h40 m-160 0 h20 m140 0 h20 m-180 0 q10 0 10 10 m160 0 q0 -10 10 -10 m-170 10 v24 m160 0 v-24 m-160 24 q0 10 10 10 m140 0 q10 0 10 -10 m-150 10 h10 m120 0 h10 m23 -44 h-3"></path>
<polygon points="687 17 695 13 695 21"></polygon>
<polygon points="687 17 679 13 679 21"></polygon>
</svg></div>
<div><svg width="616" height="68">
<polygon points="9 17 1 13 1 21"></polygon>
<polygon points="17 17 9 13 9 21"></polygon>
<rect x="31" y="3" width="62" height="32" rx="10"></rect>
<rect x="29" y="1" width="62" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="39" y="21">SHOW</text>
<rect x="133" y="35" width="86" height="32" rx="10"></rect>
<rect x="131" y="33" width="86" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="141" y="53">COMPACT</text>
<rect x="279" y="35" width="38" height="32" rx="10"></rect>
<rect x="277" y="33" width="38" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="287" y="53">KV</text>
<rect x="357" y="3" width="64" height="32" rx="10"></rect>
<rect x="355" y="1" width="64" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="365" y="21">TRACE</text>
<rect x="441" y="3" width="48" height="32" rx="10"></rect>
<rect x="439" y="1" width="48" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="449" y="21">FOR</text>
<rect x="509" y="3" width="80" height="32" rx="10"></rect>
<rect x="507" y="1" width="80" height="32" class="terminal" rx="10"></rect>
<text class="terminal" x="517" y="21">SESSION</text>
<path class="line" d="m17 17 h2 m0 0 h10 m62 0 h10 m20 0 h10 m0 0 h96 m-126 0 h20 m106 0 h20 m-146 0 q10 0 10 10 m126 0 q0 -10 10 -10 m-136 10 v12 m126 0 v-12 m-126 12 q0 10 10 10 m106 0 q10 0 10 -10 m-116 10 h10 m86 0 h10 m40 -32 h10 m0 0 h48 m-78 0 h20 m58 0 h20 m-98 0 q10 0 10 10 m78 0 q0 -10 10 -10 m-88 10 v12 m78 0 v-12 m-78 12 q0 10 10 10 m58 0 q10 0 10 -10 m-68 10 h10 m38 0 h10 m20 -32 h10 m64 0 h10 m0 0 h10 m48 0 h10 m0 0 h10 m80 0 h10 m3 0 h-3"></path>
<polygon points="607 17 615 13 615 21"></polygon>
<polygon points="607 17 599 13 599 21"></polygon>
</svg></div>
2 changes: 1 addition & 1 deletion releases/v2.1.0-alpha.20180702.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Get future release notes emailed to you:
- CockroachDB now produces a clearer message when special functions (e.g., `generate_series()`) are used in an invalid context (e.g., `LIMIT`). [#26425][#26425]
- Fixed a rare crash on node [decommissioning](../v2.1/remove-nodes.html). [#26706][#26706]
- Commands are now abandoned earlier once a deadline has been reached. [#26643][#26643]
- Using [`SHOW TRACE FOR SESSION`](../v2.1/show-trace.html) multiple times without an intervening `SET tracing` statement now properly outputs the trace without introducing extraneous duplicate rows. [#26746][#26746]
- Using [`SHOW TRACE FOR SESSION`](../v2.1/show-trace-for-session.html) multiple times without an intervening `SET tracing` statement now properly outputs the trace without introducing extraneous duplicate rows. [#26746][#26746]
- The output of debug and tracing commands is no longer corrupted when byte array values contain invalid UTF-8 sequences. [#26769][#26769]
- Joins across two [interleaved tables](../v2.1/interleave-in-parent.html) no longer return incorrect results under certain circumstances when the equality columns aren't all part of the interleaved columns. [#26756][#26756]
- Prepared statements using [`RETURNING NOTHING`](../v2.1/parallel-statement-execution.html) that are executed using the `EXECUTE` statement are now properly parallelized. [#26668][#26668]
Expand Down
2 changes: 1 addition & 1 deletion v2.1/explain.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You can `EXPLAIN` on the following statements:
- [`SELECT`](select-clause.html) and any [selection query](selection-queries.html)
- [`SET`](set-vars.html)
- [`SET CLUSTER SETTING`](set-cluster-setting.html)
- [`SHOW BACKUP`](show-backup.html), [`SHOW COLUMNS`](show-columns.html), [`SHOW CONSTRAINTS`](show-constraints.html), [`SHOW CREATE TABLE`](show-create-table.html), [`SHOW CREATE VIEW`](show-create-view.html), [`SHOW CREATE SEQUENCE`](show-create-sequence.html), [`SHOW CLUSTER SETTING`](show-cluster-setting.html), [`SHOW DATABASES`](show-databases.html), [`SHOW GRANTS`](show-grants.html), [`SHOW INDEX`](show-index.html), [`SHOW JOBS`](show-jobs.html), [`SHOW QUERIES`](show-queries.html), [`SHOW SESSIONS`](show-sessions.html), [`SHOW TABLES`](show-tables.html), [`SHOW TRACE`](show-trace.html), [`SHOW USERS`](show-users.html), [`SHOW HISTOGRAM`](sql-grammar.html#show_histogram_stmt)
- [`SHOW BACKUP`](show-backup.html), [`SHOW COLUMNS`](show-columns.html), [`SHOW CONSTRAINTS`](show-constraints.html), [`SHOW CREATE TABLE`](show-create-table.html), [`SHOW CREATE VIEW`](show-create-view.html), [`SHOW CREATE SEQUENCE`](show-create-sequence.html), [`SHOW CLUSTER SETTING`](show-cluster-setting.html), [`SHOW DATABASES`](show-databases.html), [`SHOW GRANTS`](show-grants.html), [`SHOW INDEX`](show-index.html), [`SHOW JOBS`](show-jobs.html), [`SHOW QUERIES`](show-queries.html), [`SHOW SESSIONS`](show-sessions.html), [`SHOW TABLES`](show-tables.html), [`SHOW TRACE FOR SESSION`](show-trace-for-session.html), [`SHOW USERS`](show-users.html), [`SHOW HISTOGRAM`](sql-grammar.html#show_histogram_stmt)
- [`UPDATE`](update.html)
- [`UPSERT`](upsert.html)

Expand Down
45 changes: 23 additions & 22 deletions v2.1/set-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ The variable name is case insensitive. The value can be a list of one or more it

Variable name | Description | Initial value | Can be viewed with [`SHOW`](show-vars.html)? |
---------------|--------------|---------------|-----------------------------------------
`application_name` | The current application name for statistics collection. | Empty string | Yes
`database` | The [current database](sql-name-resolution.html#current-database). Database in connection string, or empty if not specified | Yes
`default_transaction_isolation` | The default transaction isolation level for the current session. See [Transaction parameters](transactions.html#transaction-parameters) and [`SET TRANSACTION`](set-transaction.html) for more details. | Settings in connection string, or "`SERIALIZABLE`" if not specified | 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 [`SET TRANSACTION`](set-transaction.html) for more details. | `off` | Yes
`sql_safe_updates` | If `true`, disallow potentially unsafe SQL statements, including `DELETE` without a `WHERE` clause, `UPDATE` without a `WHERE` clause, and `ALTER TABLE ... DROP COLUMN`. See [Allow Potentially Unsafe SQL Statements](use-the-built-in-sql-client.html#allow-potentially-unsafe-sql-statements) for more details. | `true` for interactive sessions from the [built-in SQL client](use-the-built-in-sql-client.html) unless `--safe-updates=false` is specified,<br>`false` for sessions from other clients | Yes
`search_path` | A list of schemas that will be searched to resolve unqualified table or function names. For more details, see [Name Resolution](sql-name-resolution.html). | "`{public}`" | Yes
`server_version_num` | The version of PostgreSQL that CockroachDB emulates. | Version-dependent | Yes
`statement_timeout` | <span class="version-tag">New in v2.1:</span> The amount of time a statement can run before being stopped.<br><br>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` | Yes
`timezone` | The default time zone for the current session.<br><br>This value can be a string representation of a local system-defined time zone (e.g., `'EST'`, `'America/New_York'`) or a positive or negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`, `LOCAL`, or `0` sets the session time zone to `UTC`.</br><br>See [Setting the Time Zone](#set-time-zone) for more details. <br><br>This session variable was named `"time zone"` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `UTC` | Yes
`tracing` | The trace recording state.<br><br>See [`SET TRACING`](#set-tracing) for more details. | `off` | Yes
`transaction_isolation` | The isolation level of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br>This session variable was called `transaction isolation level` (with spaces) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `SERIALIZABLE` | Yes
`transaction_priority` | The priority of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br>This session variable was called `transaction priority` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `NORMAL` | Yes
`transaction_read_only` | The access mode of the current transaction. See [Set Transaction](set-transaction.html) for more details. | `off` | Yes
`transaction_status` | The state of the current transaction. See [Transactions](transactions.html) for more details.<br><br>This session variable was called `transaction status` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `NoTxn` | Yes
`client_encoding` | Ignored; recognized for compatibility with PostgreSQL clients. Only possible value is "`UTF8`". | N/A | No
`client_min_messages` | Ignored; recognized for compatibility with PostgreSQL clients. Only posible value is "`on`". | N/A | No
`extra_float_digits` | Ignored; recognized for compatibility with PostgreSQL clients. | N/A | No
`standard_conforming_strings` | Ignored; recognized for compatibility with PostgreSQL clients. | N/A | No
`application_name` | The current application name for statistics collection. | Empty string | Yes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this block all whitespace changes? (I think yes but wanted to confirm.)

`database` | The [current database](sql-name-resolution.html#current-database). Database in connection string, or empty if not specified | Yes
`default_transaction_isolation` | The default transaction isolation level for the current session. See [Transaction parameters](transactions.html#transaction-parameters) and [`SET TRANSACTION`](set-transaction.html) for more details. | Settings in connection string, or "`SERIALIZABLE`" if not specified | 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 [`SET TRANSACTION`](set-transaction.html) for more details. | `off` | Yes
`sql_safe_updates` | If `true`, disallow potentially unsafe SQL statements, including `DELETE` without a `WHERE` clause, `UPDATE` without a `WHERE` clause, and `ALTER TABLE ... DROP COLUMN`. See [Allow Potentially Unsafe SQL Statements](use-the-built-in-sql-client.html#allow-potentially-unsafe-sql-statements) for more details. | `true` for interactive sessions from the [built-in SQL client](use-the-built-in-sql-client.html) unless `--safe-updates=false` is specified,<br>`false` for sessions from other clients | Yes
`search_path` | A list of schemas that will be searched to resolve unqualified table or function names. For more details, see [Name Resolution](sql-name-resolution.html). | "`{public}`" | Yes
`server_version_num` | The version of PostgreSQL that CockroachDB emulates. | Version-dependent | Yes
`statement_timeout` | <span class="version-tag">New in v2.1:</span> The amount of time a statement can run before being stopped.<br><br>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` | Yes
`timezone` | The default time zone for the current session.<br><br>This value can be a string representation of a local system-defined time zone (e.g., `'EST'`, `'America/New_York'`) or a positive or negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`, `LOCAL`, or `0` sets the session time zone to `UTC`.</br><br>See [Setting the Time Zone](#set-time-zone) for more details. <br><br>This session variable was named `"time zone"` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `UTC` | Yes
`tracing` | The trace recording state.<br><br>See [`SET TRACING`](#set-tracing) for more details. | `off` | Yes
`transaction_isolation` | The isolation level of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br>This session variable was called `transaction isolation level` (with spaces) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `SERIALIZABLE` | Yes
`transaction_priority` | The priority of the current transaction. See [Transaction parameters](transactions.html#transaction-parameters) for more details.<br><br>This session variable was called `transaction priority` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `NORMAL` | Yes
`transaction_read_only` | The access mode of the current transaction. See [Set Transaction](set-transaction.html) for more details. | `off` | Yes
`transaction_status` | The state of the current transaction. See [Transactions](transactions.html) for more details.<br><br>This session variable was called `transaction status` (with a space) in CockroachDB 1.x. It has been renamed for compatibility with PostgreSQL. | `NoTxn` | Yes
`client_encoding` | Ignored; recognized for compatibility with PostgreSQL clients. Only possible value is "`UTF8`". | N/A | No
`client_min_messages` | Ignored; recognized for compatibility with PostgreSQL clients. Only posible value is "`on`". | N/A | No
`extra_float_digits` | Ignored; recognized for compatibility with PostgreSQL clients. | N/A | No
`standard_conforming_strings` | Ignored; recognized for compatibility with PostgreSQL clients. | N/A | No

Special syntax cases:

Syntax | Equivalent to | Notes
Syntax | Equivalent to | Notes
--------|---------------|-------
`USE ...` | `SET database = ...` | This is provided as convenience for users with a MySQL/MSSQL background.
`SET NAMES ...` | `SET client_encoding = ...` | This is provided for compatibility with PostgreSQL clients.
Expand Down Expand Up @@ -237,15 +237,16 @@ negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`,

## `SET TRACING`

`SET TRACING` changes the trace recording state of the current session. A trace recording can be inspected with the [`SHOW TRACE FOR SESSION`](show-trace.html) statement.
`SET TRACING` changes the trace recording state of the current session. A trace recording can be inspected with the [`SHOW TRACE FOR SESSION`](show-trace-for-session.html) statement.

Value | Description
-------|------------
`off` | Trace recording is disabled.
`cluster` | Trace recording is enabled; distributed traces are collected.
`on` | Same as `cluster`.
`kv` | Same as `cluster` except that "kv messages" are collected instead of regular trace messages. See [`SHOW TRACE`](show-trace.html).
`kv` | Same as `cluster` except that "kv messages" are collected instead of regular trace messages. See [`SHOW TRACE FOR SESSION`](show-trace-for-session.html).
`local` | Trace recording is enabled; only trace messages issued by the local node are collected.
`results` | Result rows and row counts are copied to the session trace. This must be specified to in order for the output of a query to be printed in the session trace.<br><br>Example: `SET tracing = kv, results;`

## See also

Expand All @@ -254,4 +255,4 @@ negative numeric offset from UTC (e.g., `-7`, `+7`). Also, `DEFAULT`,
- [`SET CLUSTER SETTING`](set-cluster-setting.html)
- [`SHOW` (session variable)](show-vars.html)
- [The `TIMESTAMP` and `TIMESTAMPTZ` data types.](timestamp.html)
- [`SHOW TRACE`](show-trace.html)
- [`SHOW TRACE FOR SESSION`](show-trace-for-session.html)
Loading