Skip to content
Open
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 src/current/_includes/v26.2/cdc/cdc-schema-locked-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Enable `schema_locked` on the watched table with the [`ALTER TABLE`]({% link {{
ALTER TABLE watched_table SET (schema_locked = true);
~~~

CockroachDB attempts to automatically unset `schema_locked` before performing a schema change and reapply it when done. However, certain schema changes (such as `ALTER TABLE ... SET LOCALITY`) cannot automatically unset it. For these cases, you must manually unlock the table with `schema_locked = false`, complete the schema change, and then lock the table again with `schema_locked = true`. The changefeed will run as normal while `schema_locked` is unset, but it will not benefit from the performance optimization.
By default, CockroachDB attempts to automatically unset `schema_locked` before performing many schema changes and reapplies it when done. To require manual unlocks for all DDL on schema-locked tables, set [`sql.schema.auto_unlock.enabled`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-sql-schema-auto-unlock-enabled) to `false`. Some schema changes, such as `ALTER TABLE ... SET LOCALITY`, cannot automatically unset `schema_locked` even when automatic unlocking is enabled. For these cases, you must manually unlock the table with `schema_locked = false`, complete the schema change, and then lock the table again with `schema_locked = true`. The changefeed will run as normal while `schema_locked` is unset, but it will not benefit from the performance optimization.

{% include_cached copy-clipboard.html %}
~~~ sql
ALTER TABLE watched_table SET (schema_locked = false);
~~~
~~~
4 changes: 4 additions & 0 deletions src/current/_includes/v26.2/misc/session-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
| <a id="sql-safe-updates"></a> `sql_safe_updates` | If `true`, the following potentially unsafe SQL statements are disallowed: [`DROP DATABASE`]({% link {{ page.version.version }}/drop-database.md %}) of a non-empty database and all dependent objects; [`DELETE`]({% link {{ page.version.version }}/delete.md %}) and [`UPDATE`]({% link {{ page.version.version }}/update.md %}) without a `WHERE` clause, unless a [`LIMIT`]({% link {{ page.version.version }}/limit-offset.md %}) clause is included; [`SELECT ... FOR UPDATE`]({% link {{ page.version.version }}/select-for-update.md %}) and [`SELECT ... FOR SHARE`]({% link {{ page.version.version }}/select-for-update.md %}) without a `WHERE` or [`LIMIT`]({% link {{ page.version.version }}/limit-offset.md %}) clause; [`ALTER TABLE ... DROP COLUMN`]({% link {{ page.version.version }}/alter-table.md %}#drop-column); and converting an existing table to [`REGIONAL BY ROW`]({% link {{ page.version.version }}/alter-table.md %}#set-the-table-locality-to-regional-by-row) using [`ALTER TABLE ... LOCALITY`]({% link {{ page.version.version }}/alter-table.md %}#regional-by-row), unless a [region column]({% link {{ page.version.version }}/alter-table.md %}#crdb_region) has already been added to the table.<br/>For more details, refer to [Allow potentially unsafe SQL statements]({% link {{ page.version.version }}/cockroach-sql.md %}#allow-potentially-unsafe-sql-statements). | `true` for interactive sessions from the [built-in SQL client]({% link {{ page.version.version }}/cockroach-sql.md %}), <br/>`false` for sessions from other clients | Yes | Yes |
| <a id="statement-timeout"></a> `statement_timeout` | The amount of time a statement can run before being stopped. <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'`). <br/>A value of `0` turns it off. | The value set by the `sql.defaults.statement_timeout` [cluster setting]({% link {{ page.version.version }}/cluster-settings.md %}) (`0s`, by default). | Yes | Yes |
| <a id="stub-catalog-tables"></a> `stub_catalog_tables` | If `off`, querying an unimplemented, empty [`pg_catalog`]({% link {{ page.version.version }}/pg-catalog.md %}) 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="tcp-keepalives-count"></a> <span class="version-tag">New in v26.2:</span> `tcp_keepalives_count` | The number of TCP keepalive probes sent before an idle connection is considered lost. `0` uses the [`server.sql_tcp_keep_alive.count`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-server-sql-tcp-keep-alive-count) cluster setting. | `0` | Yes | Yes |
| <a id="tcp-keepalives-idle"></a> <span class="version-tag">New in v26.2:</span> `tcp_keepalives_idle` | The idle time before TCP keepalive probes are sent. `0` uses the [`server.sql_tcp_keep_alive.idle`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-server-sql-tcp-keep-alive-idle) cluster setting. Stored in seconds; can be set as integer seconds or duration strings, truncated to whole seconds. | `0` | Yes | Yes |
| <a id="tcp-keepalives-interval"></a> <span class="version-tag">New in v26.2:</span> `tcp_keepalives_interval` | The time between TCP keepalive probes. `0` uses the [`server.sql_tcp_keep_alive.interval`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-server-sql-tcp-keep-alive-interval) cluster setting. Stored in seconds; can be set as integer seconds or duration strings, truncated to whole seconds. | `0` | Yes | Yes |
| <a id="tcp-user-timeout"></a> <span class="version-tag">New in v26.2:</span> `tcp_user_timeout` | The TCP user timeout for unacknowledged data. `0` uses the [`server.sql_tcp_user.timeout`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-server-sql-tcp-user-timeout) cluster setting. Stored in milliseconds; can be set as integer milliseconds or duration strings, truncated to whole milliseconds. | `0` | Yes | Yes |
| <a id="timezone"></a> `timezone` | The default time zone for the current session. | `UTC` | Yes | Yes |
| <a id="tracing"></a> `tracing` | The trace recording state. | `off` | Yes | Yes |
| <a id="transaction-isolation"></a> `transaction_isolation` | The isolation level at which the transaction executes ([`SERIALIZABLE`]({% link {{ page.version.version }}/demo-serializable.md %}) or [`READ COMMITTED`]({% link {{ page.version.version }}/read-committed.md %})). See [Isolation levels]({% link {{ page.version.version }}/transactions.md %}#isolation-levels). | `SERIALIZABLE` | Yes | Yes |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------|---------------|
| `exclude_data_from_backup` | Exclude the data in this table from any future backups. | Boolean | `false` |
| `infer_rbr_region_col_using_constraint` | For [`REGIONAL BY ROW`]({% link {{ page.version.version }}/table-localities.md %}#regional-by-row-tables) tables, automatically populate the hidden `crdb_region` column on `INSERT`, `UPDATE`, and `UPSERT` by looking up the region of the referenced parent row. Set this parameter to the name of a [foreign key]({% link {{ page.version.version }}/foreign-key.md %}) constraint on the table that includes the `crdb_region` column. The foreign key cannot be dropped while the parameter is set. | String | `NULL` |
| <a name="storage-parameter-schema-locked"></a> `schema_locked` | Indicates that a [schema change]({% link {{ page.version.version }}/online-schema-changes.md %}) is not currently ongoing on this table. CockroachDB automatically unsets this parameter before performing a schema change and reapplies it when done. Enabling `schema_locked` can help [improve performance of changefeeds]({% link {{ page.version.version }}/create-changefeed.md %}#disallow-schema-changes-on-tables-to-improve-changefeed-performance) running on this table. | Boolean | `false` |
| <a name="storage-parameter-schema-locked"></a> `schema_locked` | Indicates that a [schema change]({% link {{ page.version.version }}/online-schema-changes.md %}) is not currently ongoing on this table. By default, CockroachDB attempts to automatically unset this parameter before performing many schema changes and reapplies it when done. To require manual unlocks for all DDL on schema-locked tables, set [`sql.schema.auto_unlock.enabled`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-sql-schema-auto-unlock-enabled) to `false`. Enabling `schema_locked` can help [improve performance of changefeeds]({% link {{ page.version.version }}/create-changefeed.md %}#disallow-schema-changes-on-tables-to-improve-changefeed-performance) running on this table. | Boolean | `false` |
| `sql_stats_automatic_collection_enabled` | Enable automatic collection of [full]({% link {{ page.version.version }}/cost-based-optimizer.md %}#full-statistics) and [partial]({% link {{ page.version.version }}/cost-based-optimizer.md %}#partial-statistics) statistics for this table. | Boolean | `true` |
| `sql_stats_automatic_collection_min_stale_rows` | Minimum number of stale rows in this table that will trigger a full statistics refresh. | Integer | 500 |
| `sql_stats_automatic_collection_fraction_stale_rows` | Fraction of stale rows in this table that will trigger a full statistics refresh. | Float | 0.2 |
Expand Down
2 changes: 1 addition & 1 deletion src/current/v26.2/online-schema-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ For advice about how to avoid running out of space during an online schema chang

### Improve changefeed performance with `schema_locked`

Set the [`schema_locked` table storage parameter]({% link {{ page.version.version }}/with-storage-parameter.md %}#storage-parameter-schema-locked) to `true` to indicate that a schema change is not currently ongoing on a table. CockroachDB automatically unsets this parameter before performing a schema change and reapplies it when done. Enabling `schema_locked` can help [improve performance of changefeeds]({% link {{ page.version.version }}/create-changefeed.md %}#disallow-schema-changes-on-tables-to-improve-changefeed-performance) running on the table, which can reduce commit-to-emit latency.
Set the [`schema_locked` table storage parameter]({% link {{ page.version.version }}/with-storage-parameter.md %}#storage-parameter-schema-locked) to `true` to indicate that a schema change is not currently ongoing on a table. By default, CockroachDB attempts to automatically unset this parameter before performing many schema changes and reapplies it when done. To require manual unlocks for all DDL on schema-locked tables, set [`sql.schema.auto_unlock.enabled`]({% link {{ page.version.version }}/cluster-settings.md %}#setting-sql-schema-auto-unlock-enabled) to `false`. Some schema changes, such as `ALTER TABLE ... SET LOCALITY`, still require a manual unlock even when automatic unlocking is enabled. Enabling `schema_locked` can help [improve performance of changefeeds]({% link {{ page.version.version }}/create-changefeed.md %}#disallow-schema-changes-on-tables-to-improve-changefeed-performance) running on the table, which can reduce commit-to-emit latency.

Use the [`create_table_with_schema_locked` session variable]({% link {{ page.version.version }}/set-vars.md %}#create_table_with_schema_locked) to set this storage parameter to `true` on every table created in the session. In v26.1 and later, it is enabled by default.

Expand Down
1 change: 1 addition & 0 deletions src/current/v26.2/sql-feature-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,5 @@ XML | ✗ | Standard | XML data can be stored as `BYTES`, but we do not offer XM
Triggers | Partial | Standard | [Triggers documentation]({% link {{ page.version.version }}/triggers.md %})
Row-level TTL | ✓ | Common Extension | Automatically delete expired rows. For more information, see [Batch-delete expired data with Row-Level TTL]({% link {{ page.version.version }}/row-level-ttl.md %}).
User-defined functions | Partial | Standard | [User-Defined Functions documentation]({% link {{ page.version.version }}/user-defined-functions.md %})
<span class="version-tag">New in v26.2:</span> `CREATE EXTENSION "fuzzystrmatch"` | ✓ | Common Extension | Provides PostgreSQL-compatible fuzzy string matching functions including `soundex()`, `difference()`, `levenshtein()`, `metaphone()`, [`dmetaphone()`]({% link {{ page.version.version }}/functions-and-operators.md %}#dmetaphone), [`dmetaphone_alt()`]({% link {{ page.version.version }}/functions-and-operators.md %}#dmetaphone_alt), and [`daitch_mokotoff()`]({% link {{ page.version.version }}/functions-and-operators.md %}#daitch_mokotoff). These functions are available without running `CREATE EXTENSION "fuzzystrmatch"`. CockroachDB does not have full support for `CREATE EXTENSION`. [GitHub issue tracking `CREATE EXTENSION` support](https://github.com/cockroachdb/cockroach/issues/74777).
`CREATE EXTENSION "uuid-ossp"` | ✓ | Common Extension | Provides access to several additional [UUID generation functions]({% link {{ page.version.version }}/functions-and-operators.md %}#id-generation-functions). Note that these UUID functions are available without typing `CREATE EXTENSION "uuid-ossp"`. CockroachDB does not have full support for `CREATE EXTENSION`. [GitHub issue tracking `CREATE EXTENSION` support](https://github.com/cockroachdb/cockroach/issues/74777).
Loading