--- title: What's New in v20.1.0 toc: true summary: Additions and changes in CockroachDB version v20.1.0. --- ## May 12, 2020 With the release of CockroachDB v20.1, we've made a variety of productivity, performance, and security improvements. Check out a comprehensive [summary of the most significant user-facing changes](#summary) and then [upgrade to CockroachDB v20.1](../v20.1/upgrade-cockroach-version.html). You can also read more about these changes in the [v20.1 blog post](https://www.cockroachlabs.com/blog/cockroachdb-20-1-release/) or sign up for our [live webinar on May 20](https://www.cockroachlabs.com/webinars/introducing-cockroachdb-20-1-build-fast-and-build-to-last/). Get future release notes emailed to you:
## Downloads
## Docker image {% include copy-clipboard.html %} ~~~ shell $ docker pull cockroachdb/cockroach:v20.1.0 ~~~ ## Summary This section summarizes the most significant, user-facing changes in v20.1.0. For a complete list of features and changes, including bug fixes and performance improvements, see the [release notes](index.html#testing-releases) for previous testing releases. - [CockroachCloud](#cockroachcloud) - [Core features](#core-features) - [Enterprise features](#enterprise-features) - [Backward-incompatible changes](#backward-incompatible-changes) - [Known limitations](#known-limitations) - [Education](#education) ### CockroachCloud - You can now use the code `CRDB30` for a **free 30-day trial of CockroachCloud**. - **[CockroachCloud pricing](https://www.cockroachlabs.com/pricing/)** is now available on our website. - **VPC peering** is now supported for CockroachCloud clusters running on GCP. [Contact us](https://www.cockroachlabs.com/contact-sales/) to set up a VPC peering-enabled CockroachCloud cluster. ### Core features These features are freely available in the core version and do not require an enterprise license. Area | Feature | Description -----|---------|------------ SQL | **Online Primary Key Changes** | The new [`ALTER TABLE ... ALTER PRIMARY KEY`](../v20.1/alter-primary-key.html) statement lets you change a table’s primary key with no interruption to data access. The old primary key is converted to a `UNIQUE` secondary index to help optimize the performance of queries that still filter on the old key. However, if this conversion is not desired, you can [drop and add a primary key constraint](../v20.1/add-constraint.html#drop-and-add-a-primary-key-constraint) instead. SQL | **Schema Change Controls** | [Online schema changes](../v20.1/online-schema-changes.html) can now be paused, resumed, and cancelled via [`PAUSE JOB`](../v20.1/pause-job.html), [`RESUME JOB`](../v20.1/resume-job.html), and [`CANCEL JOB`](../v20.1/cancel-job.html). SQL | **Foreign Key Improvements** | CockroachDB now supports [multiple foreign key constraints on a single column](../v20.1/foreign-key.html#add-multiple-foreign-key-constraints-to-a-single-column). Also, it's now possible to drop the index on foreign key columns, or on the referenced columns, if another index exists on the same columns and fulfills [indexing requirements](../v20.1/foreign-key.html#rules-for-creating-foreign-keys). SQL | **`SELECT FOR UPDATE`** | The new [`SELECT FOR UPDATE`](../v20.1/select-for-update.html) statement lets you order transactions by controlling concurrent access to one or more rows of a table. It works by locking the rows returned by a selection query, such that other transactions attempting to `SELECT` the same data and then `UPDATE` the results of that selection are forced to wait for the transaction that locked the rows to finish. This prevents [transaction retries](../v20.1/transactions.html#transaction-retries) that would otherwise occur and, thus, leads to increased throughput and decreased tail latency for contended operations. SQL | **Nested Transactions and Savepoints** | CockroachDB now supports the nesting of transactions using savepoints. These [nested transactions](../v20.1/transactions.html#nested-transactions), also known as sub-transactions, can be rolled back without discarding the state of the entire surrounding transaction. This can be useful in applications that abstract database access using an application development framework or ORM. Different components of the application can operate on different sub-transactions without having to know about each others' internal operations, while trusting that the database will maintain isolation between sub-transactions and preserve data integrity. SQL | **Hash-Sharded Indexes** | For tables indexed on sequential keys, CockroachDB nows offers [hash-sharded indexes](../v20.1/indexes.html#hash-sharded-indexes) to distribute sequential traffic uniformly across ranges, eliminating single-range hotspots and improving write performance on sequentially-keyed indexes at a small cost to read performance. This feature is currently [experimental](../v20.1/experimental-features.html). SQL | **Slow Query Log** | You can now enable a [slow query log](../v20.1/query-behavior-troubleshooting.html#using-the-slow-query-log) to record SQL queries whose service latency exceeds a specified threshold. SQL | **`EXPLAIN` Improvements** | The new [`EXPLAIN ANALYZE (DEBUG)`](../v20.1/explain-analyze.html#debug-option) option executes a query and generates a link to a ZIP file that contains the physical query plan, execution statistics, statement tracing, and other information about the query. Also, the `(DISTSQL, TYPES)` option on `EXPLAIN` and `EXPLAIN ANALYZE` include the data types of the input columns in the physical plan. SQL | **Recursive Common Table Expressions** | CockroachDB now supports [common table expressions that contain subqueries that refer to their own output](../v20.1/common-table-expressions.html#recursive-common-table-expressions). SQL | **`TIMETZ` Data Type** | CockroachDB now supports the [`TIMETZ` variant](../v20.1/time.html#timetz) of the `TIME` data type for SQL standard compliance and increased compatibility with ORMS. SQL | **Precision in Time Values** | CockroachDB now supports precision levels from 0 (seconds) to 6 (microseconds) for [`TIME`/`TIMETZ`](../v20.1/time.html#precision) and [`INTERVAL`](../v20.1/interval.html#precision) values. Precision in time values specifies the number of fractional digits retained in the seconds field. SQL | **Vectorized Execution Improvements** | [Vectorized execution](../v20.1/vectorized-execution.html) now supports [hash joins](../v20.1/joins.html#hash-joins), [merge joins](../v20.1/joins.html#merge-joins), most [window functions](../v20.1/window-functions.html), as well as the [`TIMESTAMPTZ`](../v20.1/timestamp.html) data type in addition to several other previously [supported data types](../v20.1/data-types.html). SQL | **Column Families in Secondary Indexes** | [Secondary indexes](../v20.1/column-families.html) now respect the column family definitions applied to tables. When you define a secondary index, CockroachDB breaks the secondary index key-value pairs into column families, according to the family and stored column configurations. SQL | **Temporary Tables** | CockroachDB now supports session-scoped [temporary tables](../v20.1/temporary-tables.html), [views](../v20.1/views.html#temporary-views), and [sequences](../v20.1/create-sequence.html#temporary-sequences). Unlike persistent objects, temp objects can only be accessed from the session in which they were created, and they are dropped at the end of the session. This feature is currently [experimental](../v20.1/experimental-features.html). Dev Tools | **Expanded ORM Support** | CockroachDB now supports additional Postgres-compatible ORMs, including [Django](../v20.1/build-a-python-app-with-cockroachdb-django.html), [PonyORM](../v20.1/build-a-python-app-with-cockroachdb-pony.html), and [pewee](../v20.1/install-client-drivers.html#peewee) for Python developers, and [jOOQ](../v20.1/build-a-java-app-with-cockroachdb-jooq.html) for Java developers. I/O | **Bulk Import Improvements** | The [`IMPORT`](../v20.1/import.html) and [`IMPORT INTO`](../v20.1/import-into.html) statements now support bulk importing [from Avro files](../v20.1/migrate-from-avro.html). This makes it easier to migrate from systems like Spanner that export data in the Avro format.

Also, the new [`cockroach nodelocal upload`](../v20.1/cockroach-nodelocal-upload.html) command makes it easier to upload a file to a node's external IO directory for import from the node rather than from cloud storage.

Finally, [paused](../v20.1/pause-job.html) imports, when [resumed](../v20.1/resume-job.html), now continue from their internally recorded progress instead of starting over. Security | **RBAC Changes** | All [role-based access control (RBAC) features](../v20.1/authorization.html#roles) (`CREATE ROLE`, `ALTER ROLE`, `DROP ROLE`, `GRANT ROLE`, `REVOKE ROLE`) are now covered by the [BSL license](../v20.1/licensing-faqs.html) and available to non-enterprise users. Security | **Various Improvements** | Several security features have been added to CockroachDB v20.1, including the ability to [customize the mapping between TLS certificates and principals](../v20.1/create-security-certificates-openssl.html#step-2-create-the-certificate-and-key-pairs-for-nodes), to [name user/roles with periods](../v20.1//create-user.html#considerations) so as to reflect the structure of internet domain names, to [allow or disallow users from authenticating](../v20.1/create-user.html#set-login-privileges-for-a-user), and to [allow or disallow users from creating, altering, and dropping other users](../v20.1/create-user.html#allow-the-user-to-create-other-users).

Also, CockroachDB's support for the PostgreSQL Host-Based Authentication (HBA) configuration language, which enables sites to customize the principal/client address/authentication method matrix, has been extended and unified. CLI | **Demo Cluster Improvements** | Several features have been added to the [`cockroach demo`](../v20.1/cockroach-demo.html) command, including the ability to start a demo cluster in secure mode using TLS certificates to encrypt network communication (via the `--insecure=false` flag), to return the client connection URLs for all nodes in a demo cluster (via the `\demo ls` shellcommand), to shut down and restart individual nodes in a multi-node demo cluster (via the `\demo_node` shell command), and to prevent the loading of a temporary enterprise license (via the `--disable-demo-license` flag). UI | **Various Improvements** | The [**Network Latency**](../v20.1/admin-ui-network-latency-page.html) page of the Admin UI is now easier to access and has been redesigned to help you understand the round-trip latencies between all nodes in your cluster.

Also, the **Statement Details** page now allows you to write information about a SQL statement to a [diagnostics bundle](../v20.1/admin-ui-statements-page.html#diagnostics) that you can download. This bundle consists of a JSON file that contains a distributed trace of the SQL statement, a physical query plan, execution statistics, and other information about the query. Internals | **Various Improvements** | CockroachDB's storage layer now uses [protected timestamps](../v20.1/architecture/storage-layer.html#protected-timestamps) to ensure the safety of historical data while also enabling shorter [GC TTLs](../v20.1/configure-replication-zones.html#gc-ttlseconds). A shorter GC TTL means that fewer previous MVCC values are kept around. This can help lower query execution costs for workloads which update rows frequently throughout the day, since the [SQL layer](../v20.1/architecture/sql-layer.html) has to scan over previous MVCC values to find the current value of a row.

Also, Cockroach's transaction layer now uses a [concurrency manager](../v20.1/architecture/transaction-layer.html#concurrency-manager) to sequence incoming requests and provide isolation between the transactions that issued those requests that intend to perform conflicting operations. ### Enterprise features These features require an [enterprise license](../v19.2/enterprise-licensing.html). Register for a 30-day trial license [here](https://www.cockroachlabs.com/get-cockroachdb/), or consider testing enterprise features locally using the [`cockroach demo`](../v19.2/cockroach-demo.html) CLI command, which starts an in-memory CockroachDB cluster with a temporary enterprise license pre-loaded. [CockroachCloud clusters](https://cockroachlabs.cloud/) also include all enterprise features. Area | Feature | Description -----|---------|------------ Recovery | **Full-cluster backup and restore** | CockroachDB's `BACKUP` feature now supports [backing up an entire cluster's data](../v20.1/backup-and-restore.html#full-backups), including all configuration and system information such as [user privileges](../v20.1/authorization.html#privileges), [zone configurations](../v20.1/configure-replication-zones.html), and [cluster settings](../v20.1/cluster-settings.html). In rare disaster recovery situations, CockroachDB's `RESTORE` feature can now [restore a full cluster backup to a new cluster](../v20.1/restore.html#full-cluster). Restoring a full cluster backup to an existing cluster is not supported. Recovery | **Encrypted backups** | CockroachDB now supports using an [encryption passphrase](../v20.1/backup-and-restore-advanced-options.html#encrypted-backup-and-restore) to encrypt data in Enterprise `BACKUP` files and to decrypt the data upon `RESTORE`. SQL | **Improved follower reads** | [Follower reads](../v20.1/follower-reads.html) are now available for `AS OF SYSTEM TIME` queries at least 4.8 seconds in the past, a much shorter window than the previous 48 seconds. ### Backward-incompatible changes Before [upgrading to CockroachDB v20.1](../v20.1/upgrade-cockroach-version.html), be sure to review the following backward-incompatible changes and adjust your application as necessary. - The `extract()` [built-in function](../v20.1/functions-and-operators.html) with sub-second arguments (millisecond, microsecond) is now Postgres-compatible and returns the total number of seconds in addition to sub-seconds instead of returning only sub-seconds. - Casting intervals to integers and floats is now Postgres-compatible and values a year at 365.25 days in seconds instead of 365 days. - The combination of the [`CHANGEFEED`](../v20.1/change-data-capture.html) options `format=experimental_avro`, `envelope=key_only`, and `updated` is now rejected. This is because the use of `key_only` prevents any rows with updated fields from being emitted, which renders the `updated` option meaningless. - The [`cockroach init`](../v20.1/cockroach-init.html) CLI command now waits for server readiness and thus no longer fails when a mistaken server address is provided. - The `cockroach user` CLI command has been removed. It was previously deprecated in CockroachDB v19.2. Note that a v19.2 client (supporting `cockroach user`) can still operate user accounts in a v20.1 server. - CockroachDB now creates files without read permissions for the "others" group. Sites that automate file management (e.g., log collection) using multiple user accounts now must ensure that the CockroachDB server and the management tools running on the same system are part of a shared unix group. - The [`GRANT`](../v20.1/grant.html) and [`REVOKE`](../v20.1/revoke.html) statements now require that the requesting user already have the target privileges themselves. For example, `GRANT SELECT ON t TO foo` requires that the requesting user already have the `SELECT` privilege on `t`. - During an [upgrade to v20.1](../v20.1/upgrade-cockroach-version.html), ongoing [schema changes](../v20.1/online-schema-changes.html) will stop making progress, and it won't be possible to manipulate them via [`PAUSE JOB`](../v20.1/pause-job.html)/[`RESUME JOB`](../v20.1/resume-job.html)/[`CANCEL JOB`](../v20.1/cancel-job.html) statements. Once the upgrade has been finalized, these schema changes will run to completion. - During an [upgrade to v20.1](../v20.1/upgrade-cockroach-version.html), new [schema changes](../v20.1/online-schema-changes.html) will be blocked and return an error, with the exception of [`CREATE TABLE`](../v20.1/create-table.html) statements without foreign key references and no-op schema change statements that use `IF NOT EXISTS`. Also, ongoing schema changes started will stop making progress, and it won't be possible to manipulate them via [`PAUSE JOB`](../v20.1/pause-job.html)/[`RESUME JOB`](../v20.1/resume-job.html)/[`CANCEL JOB`](../v20.1/cancel-job.html) statements. Once the upgrade has been finalized, ongoing schema changes will run to completion and new schema changes will be allowed. ### Known limitations For information about new and unresolved limitations in CockroachDB v20.1, with suggested workarounds where applicable, see [Known Limitations](../v20.1/known-limitations.html). ### Education Area | Topic | Description -----|-------|------------ Training | **Videos Lessons on YouTube** | Added two [Cockroach University](https://university.cockroachlabs.com) playlists to YouTube, one with the entire set of video lessons from ["Getting Started with CockroachDB"](https://www.youtube.com/playlist?list=PL_QaflmEF2e8Prn7r7CIyBKsHPgsgNO_1), and the other featuring the first batch of video lessons from the upcoming course, ["CockroachDB for Python Developers"](https://www.youtube.com/playlist?list=PL_QaflmEF2e8ijr7gxCZHSKH9-Vl8Yf9q). Docs | **Developer Guide** | Added guidance on common tasks when building apps on CockroachDB, such as [installing Postgres clients](../v20.1/install-client-drivers.html); [connecting to the database](../v20.1/connect-to-the-database.html); effectively [inserting](../v20.1/insert-data.html), [querying](../v20.1/query-data.html), [updating](../v20.1/update-data.html), and [deleting](../v20.1/delete-data.html); [handling errors](../v20.1/error-handling-and-troubleshooting.html); and [making queries fast](../v20.1/make-queries-fast.html). For convenience, much of the guidance is offered across various popular languages (Java, Python, Go) in addition to straight SQL. Docs | **"Hello World" Repos** | Added several language-specific [GitHub repos](https://github.com/cockroachlabs?q=hello-world&type=&language=) with the simple starter applications featured in our ["Hello World" tutorials](../v20.1/hello-world-example-apps.html). Docs | **Multi-Region Sample App and Tutorial** | Added a full-stack, multi-region sample application ([live demo](https://movr.cloud/), [GitHub repo](https://github.com/cockroachlabs/movr-flask)) with an [accompanying tutorial](../v20.1/multi-region-overview.html) on building a multi-region application on a multi-region CockroachCloud cluster. Also added a [video demonstration](https://www.youtube.com/playlist?list=PL_QaflmEF2e8o2heLyIt5iDUTgJE3EPkp) as a YouTube playlist. Docs | **Streaming Changefeeds to Snowflake Tutorial** | Added an [end-to-end tutorial](https://www.cockroachlabs.com/docs/cockroachcloud/stable/stream-changefeed-to-snowflake-aws.html) on how to use an Enterprise changefeed to stream row-level changes from CockroachCloud to Snowflake, an online analytical processing (OLAP) database. Docs | **Improved Backup/Restore Docs** | Updated the backup/restore docs to better separate [broadly applicable guidance and best practices](../v20.1/backup-and-restore.html) from more [advanced topics](../v20.1/backup-and-restore-advanced-options.html). Docs | **Release Support Policy** | Added a page explaining Cockroach Lab's [policy for supporting major releases of CockroachDB](release-support-policy.html), including the phases of support that each major release moves through, the currently supported releases, and an explanation of the [naming scheme](index.html#release-naming) used for CockroachDB.