Skip to content

Commit

Permalink
Start
Browse files Browse the repository at this point in the history
  • Loading branch information
kathancox committed Jul 19, 2024
1 parent e23e18c commit 2440da2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
| Parameter name | Description | Data type | Default value |
|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|-----------|---------------|
| `exclude_data_from_backup` | Exclude the data in this table from any future backups. | Boolean | `false` |
| `schema_locked` | Disallow schema changes on this table. Enabling `schema_locked` can help improve performance of changefeeds running on this table. | Boolean | `false` |
| `sql_stats_automatic_collection_enabled` | Enable [automatic statistics collection]({% link {{ page.version.version }}/cost-based-optimizer.md %}#enable-and-disable-automatic-statistics-collection-for-tables) for this table. | Boolean | `true` |
| `sql_stats_automatic_collection_min_stale_rows` | Minimum number of stale rows in this table that will trigger a statistics refresh. | Integer | 500 |
| `sql_stats_automatic_collection_fraction_stale_rows` | Fraction of stale rows in this table that will trigger a statistics refresh. | Float | 0.2 |
Expand Down
20 changes: 20 additions & 0 deletions src/current/v24.2/create-changefeed.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,26 @@ CREATE CHANGEFEED FOR TABLE table_name INTO 'external://kafka_sink'

For guidance on how to filter changefeed messages to emit [row-level TTL]({% link {{ page.version.version }}/row-level-ttl.md %}) deletes only, refer to [Change Data Capture Queries]({% link {{ page.version.version }}/cdc-queries.md %}#reference-ttl-in-a-cdc-query).

### Disallow schema changes on tables to improve changefeed performance

You can use the `schema_locked` storage parameter to disallow schema changes on a watched table, which decreases the latency between a write committing to a

To decrease the latency between a write committing to a table and it emitting to the downstream sink, you can use the `schema_locked` storage parameter to disallow schema changes on a watched table. You can lock the table before creating a changefeed or when a changefeed is running, which will enable the performance improvement for changefeeds watching the particular table.

{% include_cached copy-clipboard.html %}
~~~ sql
ALTER TABLE watched_table SET (schema_locked = true);
~~~

While `schema_locked` is enabled on a table, attempted schema changes on the table will be rejected and an error returned.

If you need to run a schema change on the locked table, then 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 = false`, but it will not benefit from the performance optimization. Once the watched table is once again locked, the changefeed will


{% comment %}If a schema change statement is attempted on a locked table, CockroachDB will reject it and return an error. The user could lock the table either before creating a changefeed or, when a changefeed is running, CockroachDB will be able to detect that and enable this performance improvement automatically.{% endcomment %}



### Manage a changefeed

For {{ site.data.products.enterprise }} changefeeds, use [`SHOW CHANGEFEED JOBS`]({% link {{ page.version.version }}/show-jobs.md %}) to check the status of your changefeed jobs:
Expand Down

0 comments on commit 2440da2

Please sign in to comment.