What's New in v20.2.0-beta.1

September 14, 2020

Warning:

A denial-of-service (DoS) vulnerability is present in CockroachDB v20.2.0 - v20.2.3 due to a bug in protobuf. This is resolved in CockroachDB v20.2.4 and later releases. When upgrading is not an option, users should audit their network configuration to verify that the CockroachDB HTTP port is not available to untrusted clients. We recommend blocking the HTTP port behind a firewall.

For more information, including other affected versions, see Technical Advisory 58932.

In addition to various updates, enhancements, and bug fixes, this first v20.2 beta release includes the following major highlights:

  • Backup schedules: You can now set up a recurring schedule that lets CockroachDB handle scheduling, conflict resolution, and resilience for your backups. Previously, it was necessary to create your own scheduler service or cron job to kick off BACKUP jobs. To create a schedule for a cluster-level backup that runs a full backup every day with the first full backup taken "now", run CREATE SCHEDULE test_backup_schedule FOR BACKUP INTO ‘<your-backup-storage-location’ RECURRING ‘@daily’ FULL BACKUP ALWAYS WITH SCHEDULE OPTIONS first_run=NOW.
  • The following SQL features improve CockroachDB's PostgreSQL compatibility:
    • User-defined schemas: Within a given database, you can now create schemas to organize your data and create finer-grained access controls. Previously, the recommendation was to create a database wherever you would normally create a schema. Now, an existing database can be converted to a schema under an existing database using ALTER DATABASE ... CONVERT TO SCHEMA WITH PARENT ....
    • Enums: ENUM types can now be created in CockroachDB using CREATE TYPE ... AS ENUM. A column type can be set to an ENUM type, which limits the column values to those defined in the ENUM.
    • Partial indexes: Partial indexes allow you to specify a subset of rows and columns to add to an index, using a WHERE filter defined at index creation.

Get future release notes emailed to you:

Downloads

Docker image

icon/buttons/copy
$ docker pull cockroachdb/cockroach-unstable:v20.2.0-beta.1

Backward-incompatible changes

  • A change to the on-disk representation for user-defined schemas, enums, and databases was made that is backward-incompatible with v20.2 alpha releases. Only schemas, enums, and databases in the middle of being dropped at the time of the upgrade are affected, and the upgrade may result in the drop never running to completion. If you are upgrading from a v20.2 alpha release to a v20.2 beta release, we advise that you avoid dropping schemas, enums and databases. #53387
  • The command-line flag --socket has been removed. It was deprecated since v20.1. Use --socket-dir instead. #53405

Security updates

  • Certificate revocation is now supported via OSCP and the cluster setting security.ocsp.mode. This makes a call to the OCSP server on every connection attempt and may wait for up to value specified with the setting security.ocsp.timeout. #53218
  • Defining or changing authentication principals or their credentials now requires the new CREATELOGIN option to be set for the requesting user or one of its roles. This includes setting/removing the CREATELOGIN option (whether the principal can log in), initializing or changing the password of a SQL user, and setting the expiration date for a password. Previously, only the CREATEROLE option could perform these changes. The pseudo-option NOCREATELOGIN can be used to revoke CREATELOGIN. The two predefined root and admin roles have the option CREATELOGIN set by default. #50601
  • Only a user which already has the CREATELOGIN option (either itself or one of its roles) can grant this option or use NOCREATELOGIN. #50601
  • Roles that had the CREATEROLE privilege prior to upgrading to this version are also automatically granted CREATELOGIN. After the upgrade, CREATELOGIN is no longer granted automatically. #50601

General changes

  • Random() and gen_random_uuid() are now supported as default expressions for IMPORT. #52247
  • IMPORT INTO is now supported for DELIMITED and PGCOPY file formats. #52628
  • Computed columns are now supported in the IMPORT INTO operation. #51321
  • As part of the transition to v20.2, the migration to upgrade schema change jobs started prior to v20.1 is no longer run. #52968
  • In some cases where AmbiguousResultErrors were produced under high load, non-ambiguous, retriable errors are now returned. #53156

Enterprise edition changes

  • SHOW BACKUP can be used to list backups in a backup collection created by BACKUP ... INTO. #52758
  • BACKUPs with revision_history now support including UDTs. #53160
  • User-defined schemas now support being backed up with revision history and restored with AS OF SYSTEM TIME. #53241
  • Scheduled jobs are now included in cluster backups. #53203
  • As part of making basic BACKUP and RESTORE free to use without an enterprise license, SHOW BACKUP and SHOW BACKUPS IN no longer require a license. #53356
  • Backups run from v20.2 nodes are no longer run in an auto-appended backup location that was created by v20.1 nodes. #53762

SQL language changes

  • Reduced memory used by scans of tables containing JSON data. #52738
  • Introduced the box2d data type to be used for geospatial comparators with GEOMETRY/GEOGRAPHY. #52771
  • EXPLAIN now shows estimated row count for scans (when statistics are available). EXPLAIN (VERBOSE) now shows the estimated row count for all operators. #52798
  • Added support for ALTER TABLE <table> OWNER TO <owner>. The command changes the owner of a table. To use the conditions, the following conditions must be met: The user executing the command must be the owner of the table, or the member of the owner role. The user executing the command must be a member of the new owner role. The new owner role must have CREATE on the schema the table belongs to. #52659
  • Added support for SELECT ... FOR {UPDATE,SHARE} NOWAIT. The option can be used to throw an error instead of blocking on contended row-level lock acquisition. #52522
  • Added privileges to user-defined types. Users can grant privileges on a type by using GRANT {USAGE/GRANT/ALL} ON TYPE <type> TO <users>. Users must have CREATE privilege in a database to create a type in that database. Users must have USAGE privilege to create an object that depends on a type. Users must have GRANT privilege to grant more privileges on the type. Owning a type implicitly gives ALL privileges on the type (USAGE,GRANT). Users must be the owner of the type to drop or alter the type. After creating a type, the creator can delegate privileges on that type by GRANTing any of the USAGE/GRANT/ALL privileges. To allow another user to grant privileges, they must have GRANT privilege and the privilege they want to GRANT. #51622
  • EXPLAIN now shows fewer "project" nodes. #52865
  • Improved display of spans in EXPLAIN. #52865
  • Added support for the DROP SCHEMA command. #52726
  • Added a new cluster setting sql.log.slow_query.internal which, when turned on in conjunction with the slow query log, causes slow internal queries to be logged to a slow internal query log at cockroach-sql-slow-internal-only.log. Internal queries are no longer logged to the slow query log. This new setting is opt-in. The default behavior is to not log slow internal queries. #52377
  • Removed some unnecessary EXPLAIN fields, and relegated others to the VERBOSE variant. #53003
  • Improved EXPLAIN output for join nodes. #53003
  • Improved EXPLAIN output for scalar groups. #53003
  • Improved EXPLAIN output for set operations. #53003
  • Box2d comparison operators are now gated by the cluster setting sql.spatial.experimental_box2d_comparison_operators.enabled. #52990
  • Added the CONTROLJOB role option. When creating/altering roles, CONTROLJOB can be passed as a role option. For example, CREATE USER <user> CONTROLJOB CREATEROLE. NOCONTROLJOB can be used to remove CONTROLJOB from the role when altering the role. CONTROLJOB allows the user to pause/resume and cancel jobs owned by non-admin users. CONTROLJOB also allows seeing all jobs owned by non-admin users, i.e., when running SHOW JOBS. #52804
  • Added a new public cluster setting sql.defaults.disallow_full_table_scans.enabled that defaults to false, which informs the session setting disallow_full_table_scans. If the session is configured to disallow full table/index scans, any user query that plans a full table/index scan is rejected. This does not apply to internal queries or queries over virtual schemas (e.g., pg_catalog). #52278
  • Renaming and dropping databases now satisfy the same transactional guarantees as online schema changes on tables: Changes will become visible if and only if the transaction commits, and a successful result indicates changes having propagated to the entire cluster. This fixes some long-standing problems with inconsistent database state being visible after renames and drops. (As a side effect of coherent caching for databases, database names can no longer be recycled in multiple schema changes in the same transaction.) #52975
  • The vectorized execution engine now supports DISTINCT and FILTERing hash aggregation. #50721
  • Added support for ALTER DATABASE OWNER TO. This command changes the owner of a database. The user must be an owner of the database to run the command. The user must also be a member of the new owner role directly or indirectly. #52736
  • UPSERT statements now acquire locks using the FOR UPDATE locking mode during their initial row scan, which improves performance for contended workloads. This behavior is configurable using the enable_implicit_select_for_update session variable and the sql.defaults.implicit_select_for_update.enabled cluster setting. #53132
  • Users can now convert existing databases into schemas under other databases through the ALTER DATABASE ... CONVERT TO SCHEMA UNDER PARENT ... command. This command can only be run by admin and is only valid for databases that don't already have any child schemas other than public. #52997
  • Implemented the IdleInTransactionSessionTimeout variable to allow terminating sessions that are idle in a transaction past the provided threshold. Set the variable by using SET idle_in_transaction_session_timeout = 'time'. Sessions that are idle in OPEN, ABORTED, and DONE(COMMITWAIT) transaction states will be terminated if the user idles longer than the threshold time. #52938
  • Non-admin users with CREATEROLE are no longer permitted to drop users with the admin role. #52881
  • Users can now specify which subdirectory they wish to write a BACKUP to, via BACKUP INTO 'subdir' IN x. This will write BACKUP data to x/subdir/. #53139
  • Added support for ALTER SCHEMA <schema> OWNER TO <owner>. The command changes the owner of a schema. To use the conditions, the following conditions must be met: The user executing the command must be the owner of the schema. The user executing the command must be a member of the new owner role. The new owner role must have CREATE on the database the schema belongs to. #52781
  • The vectorized execution engine now supports ordered aggregation with the DISTINCT clause. #53145
  • Introduced a new CONTROLCHANGEFEED role option. This grants non-admin roles the ability to create new changefeeds, as long as they have SELECT privileges on the target table. It can be conferred via ALTER ROLE <role> CONTROLCHANGEFEED and revoked via ALTER ROLE <role> NOCONTROLCHANGEFEED. #52869
  • Added support for ALTER TYPE <type> OWNER TO <owner>. The command changes the owner of a type. To use the conditions, the following conditions must be met: The user executing the command must be the owner of the type. The user executing the command must be a member of the new owner role. The new owner role must have CREATE on the schema the type belongs to. #52656
  • Introduced a new CREATEDB role option. This grants non-admin roles the ability to create new databases. It can be conferred via ALTER ROLE <role> CREATEDB and revoked via ALTER ROLE <role> NOCREATEDB. #52831
  • Schema owners can drop tables inside the schema without explicit DROP privilege on the table. #52740
  • Queries logged in the slow query log come with a reason now, which can be any combination of LATENCY_THRESHOLD, FULL_TABLE_SCAN, and FULL_SECONDARY_INDEX_SCAN. There is also a new opt-in cluster setting sql.log.slow_query.experimental_full_table_scans.enabled which, when enabled, logs full table/index scans regardless of the query execution being over the latency threshold. This setting only works if the slow query log has been turned on, i.e., a non-zero latency threshold must be specified. #53164
  • Introduced a new VIEWACTIVITY role option. This grants non-admin roles the ability to see other users' sessions and queries through SHOW SESSIONS, SHOW QUERIES, and the DB Console Statements page. #53291
  • Introduced a new CANCELQUERY role option. This grants non-admin roles the ability to cancel other users' queries and sessions. Note that non-admins are not allowed to cancel the queries or sessions of admins. #53291
  • Previously, selectivity information would be included in EXPLAIN ANALYZE diagrams if a query was executed via the vectorized execution engine. This has been removed due to being confusing and probably unhelpful. #53153
  • stall time has been renamed to IO time in EXPLAIN ANALYZE diagrams for queries executed via the vectorized execution engine. #53153
  • An INSERT ... ON CONFLICT DO UPDATE statement without a list of column names after ON CONFLICT now results in a SQL syntax error with the error code 42601. Previously, it errored with the message "there is no unique or exclusion constraint matching the ON CONFLICT specification" and the error code 42P10. #53067
  • Added support for the WITH DATA and WITH NO DATA arguments for the REFRESH MATERIALIZED VIEW command. #53052
  • Added support for the GRANT ... ON SCHEMA command. #53344
  • Added the SHOW TYPES command to list all user-defined types. #53386
  • Added support for the USAGE privilege on schemas. #53358
  • Previously, UNION ALL queries could crash the server due to OOM in some extreme cases. This is now fixed, at the expense of possible minor reduction in performance, by reducing the concurrency of evaluation of such queries. #53343
  • CockroachDB now recognizes the NOT DEFERRABLE and DEFERRABLE arguments to SET TRANSACTION. Note that the DEFERRABLE argument is still unimplemented. #53435
  • Added an invisible cluster setting sql.conn.max_read_buffer_message_size, which allows users to configure SQL statement maximum sizes across the cluster. This effect will take place upon connection restart. #53445
  • SHOW BACKUP now shows all schemas in a backup. Previously, databases, types, and schemas were not shown. Note: This introduces a breaking change in that it changes the schema of SHOW BACKUP and will no longer return the column table_name. This column is replaced by the more general object_name. #53321
  • The memory used by disk scans is now accounted for, reducing the likelihood of out-of-memory conditions resulting in process crashes (as opposed to SQL out-of-memory error messages). #52496
  • Populated the catalog table pg_catalog.pg_matviews with materialized view information. #53501
  • A value of type OID can now be compared to a value of type INT. #53523
  • Fixed a bug where temporary tables could be included in BACKUP commands. #53478
  • Added 3 new columns to the crdb_internal.node_transactions and cluster_transactions tables: num_stmts, num_retries, and num_auto_retries. These keep track of the total number of statements executed on the transaction, the number of retries encountered, and the number of automatic retries encountered, respectively. #51902
  • Added the SHOW TRANSACTIONS statement, similar to SHOW SESSIONS and variants. It shows the currently active transactions in the node or cluster, and some information about them. #51902
  • The related owner columns are now populated in pg_catalog metadata tables. #53495
  • ENUM types are no longer experimental. #53565
  • Added the tableoid system column. #53562
  • User-defined schemas are no longer experimental. #53674
  • The EXPLAIN output for UPSERT and INSERT ON CONFLICT statements now includes a list of arbiter indexes. These arbiters are the indexes used for detecting conflicts between the insert row and the existing rows in the table. #53172
  • Added support for the CREATE SCHEMA ... AUTHORIZATION command. #53583
  • EXPLAIN ANALYZE diagrams now contain "bytes read" information for table readers and lookup joins when the queries are executed via the vectorized execution engine. #53371
  • Disallowed the CONVERT TO SCHEMA command on the current database. #53564
  • The TransactionStatistics proto will only include the first 1000 statment IDs that comprise a transaction. Any statement IDs beyond 1000 will be omitted. #53553
  • Non-admin users are now permitted to execute RESTORE statements as long as the restore does not depend on implicit credentials and the user has the appropriate privileges to create all of the resulting database objects. For database restores, this means the user must have the CREATEDB role privilege. For table restores, the user must have CREATE privileges on the parent database. Full cluster restores still require admin privileges. #53650
  • Populated the information_schema.column_udt_usage catalog table. #53699
  • Previously, the pg_get_constraintdef function would return a result that included type annotations, which is a CockroachDB-specific syntax. Now it does not. #53865
  • EXPLAIN ANALYZE diagrams now contain the information about the number of rows read by the vectorized table reader. #53775
  • The new prefer_lookup_joins_for_fk session setting (and corresponding cluster setting) can be used to make foreign key checks use lookup joins if they incorrectly use hash or merge join. #53838
  • Previously, there was no way to query the transaction-level metrics collected by individual nodes. A new crdb_internal table called node_transaction_statistics allows users to query transaction metrics collected on a particular node. #53759
  • Introduced a new MODIFYCLUSTERSETTING role option. This grants non-admin roles the ability to modify certain cluster settings, currently limited to settings with the "sql.defaults" prefix. #53930
  • SQL expressions that are shown in pg_catalog columns and related functions now will be formatted with a typecast for non-numeric constants. #53965
  • Implemented geometry builtin ST_Reverse #52834
  • Implemented the && and ~ operators for comparing bounding box objects and geometries. #52913
  • Implemented the ST_CombineBBox builtin. #52903
  • Introduced the s2_max_level, s2_level_mod, and s2_max_cells storage parameters for modifying the S2 parameters for indexing GEOMETRY and GEOGRAPHY data types in an inverted index. #52800
  • Introduced the geometry_min_x, geometry_min_y, geometry_max_x, geometry_max_y storage parameters for indexing GEOMETRY data types in an inverted index. #52800
  • Implemented the ALTER MATERIALIZED VIEW and DROP MATERIALIZED VIEW commands. #52840
  • Implemented the ability to cast between box2d and GEOMETRY types. #52965
  • Implemented the PostGIS_GetBBox builtin. #52963
  • Implemented the ST_MakeBox2D builtin. #52961
  • Implemented the ST_ClipByBox2D builtin. #52955
  • Added the ability to resolve the spatial-backed builtins in the public schema. For example, public.st_x works the same as st_x. #52983
  • Implemented ST_Expand for the box2d type. #52957
  • Implemented ST_PointFromGeoHash, which converts geohash to point. #52892
  • Implemented the ST_Extent builtin for GEOMETRY aggregations into box2d. #53001
  • Implemented the geometry builtin ST_Dimension. #53068
  • Implemented the geometry builtin ST_CoordDim as an alias for ST_NDims. #53193
  • Implemented the geometry builtins ST_IsEmpty and ST_IsCollection. #53217
  • Implemented the ST_GeomFromGeoHash and ST_Box2DFromGeoHash builtins. #53162
  • Implemented the ST_Union builtin as an aggregate. The previous alpha-available ST_Union for two arguments is deprecated. #53127
  • Implemented ST_Expand for GEOMETRY-based types. #53326
  • Implemented the geometry builtins ST_Multi, ST_CollectionExtract, and ST_CollectionHomogenize. #53287
  • Implemented the geometry builtin ST_SharedPaths #53307
  • Implemented the geometry builtin ST_FlipCoordinates #53296
  • Implemented the geometry builtin ST_SymDifference. #53636
  • Implemented the geometry aggregate builtin ST_Collect. #53645
  • Implemented the geometry builtin ST_ForceCollection. #53643
  • Implemented the geometry builtin ST_SymmetricDifference. #53688
  • Implemented the geometry aggregate builtins ST_MemCollect and ST_MemUnion. #53708
  • Implemented the geometry builtin ST_Normalize. #53726
  • Implemented the geometry builtin ST_Rotate. #53709
  • Implemented the geometry builtin ST_AddPoint. #53853
  • Implemented the geometry builtin ST_Simplify and ST_SimplifyPreserveTopology. #53796
  • Implemented the geometry builtin ST_Affine. #53856
  • Implemented the geometry builtins ST_LineFromMultiPoint and ST_LineMerge. #54013
  • Implemented the geometry builtin ST_RemoveRepeatedPoints. #53999
  • Implemented geometry builtin ST_RemovePoint #53244
  • Implemented the ST_IsClosed, ST_IsSimple, and ST_IsRing builtins. #53240
  • Implemented the geometry builtin ST_Points. #53496
  • Implemented the ST_IsPolygonCW, ST_IsPolygonCCW, ST_ForcePolygonCW, and ST_ForcePolygonCCW builtins. #53243

Command-line changes

  • The --storage-engine CLI flag no longer defaults to using the last-used storage engine when unspecified. Instead, Pebble is used by default unless otherwise specified using the --storage-engine flag. #52944
  • Added alias commands ls and rm for userfile list and userfile delete. #53074
  • The new debug command decode-proto reads descriptor from stdin in hex or Base64 format (auto-detected) and a flag --schema=<fully qualified name to decode> with default value cockroach.sql.sqlbase.Descriptor and outputs to stdout the deserialized proto in JSON format. If the input is not a hex/Base64-encoded proto, then it is outputted verbatim. #52972
  • The cockroach start and cockroach start-single-node commands now enable --redactable-logs by default. The flag is also enabled by default in cockroach demo if --log-dir is passed. This causes log files to become redactable, so that cockroach debug merge-log --redact or cockroach debug zip --redact can remove sensitive information from log files. (Reminder: cockroach debug zip --redact only affects log files; other items collected by the command can still contain sensitive information.) #53263
  • The command-line flag --insecure has been marked as deprecated. See issue #53404 for details. The flag will be removed in a later version in a staged fashion: first, additional security mechanisms will be added to enable more flexible deployments which were previously done using --insecure; then the flag will be removed from server commands; then finally, in a later version, also from client commands. #53405
  • CockroachDB now recognizes the \dT alias for listing user-defined types. #53386
  • The workload sub-commands are no longer marked as experimental. #53691
  • The --geo-libs flag introduced in v20.2 alpha versions is now renamed to --spatial-libs. #53721
  • The CLI no longer prints a blanket Time for queries. Instead, if show_times is turned on and the server version is v20.2 or later, the CLI prints two separate times: the server execution time and the network latency. #52233

DB Console changes

  • Improved how SQL statement plans in the DB Console are populated, using the new EXPLAIN infrastructure. #52956
  • Previously, in some cases, the Execution Stats page would show a confusingly high Overhead latency for a statement. This could happen due to multiple statements being parsed together or due to statement execution being retried. To avoid this, we now stop considering the time between when parsing ends and execution begins when determining service latency. #53846
  • Added the Session list and Session detail pages. We now permit session and query termination from the UI. #51903

Bug fixes

  • Fixed a bug for ALTER TABLE statements with multiple actions. In certain cases if the last action had no effect, the entire statement would be treated as a no-op. #52819
  • Previously, unexpected context cancellation errors could sometimes be returned in the vectorized execution engine. This is now fixed. #52463
  • Fixed a bug where tables would not be cleaned up after a failed creation through CREATE TABLE AS. #52832
  • Fixed a bug whereby gc jobs for tables dropped as part of a DROP DATABASE CASCADE might never complete. #52818
  • Fixed an internal error that could occur when using an index-accelerated geospatial function inside an EXISTS or NOT EXISTS correlated subquery. #52942
  • Fixed a bug where if a table with a check constraint was truncated while being backfilled, the check constraint could get lost. #49399
  • Fixed bug where non-committed DETACHED BACKUPS left files which falsely indicated that a BACKUP was in progress. #52980
  • Fixed a crash that could occur when referencing a database that did not exist when trying to create a type or sequence, or when renaming a table. #53137
  • Eliminated some rare AmbiguousCommitErrors happening when CDC was used. #53146
  • A change in v20.1 caused a certain class of bulk UPDATE and DELETE statements to hang indefinitely if run in an implicit transaction. We now break up these statements to avoid starvation and prevent them from hanging indefinitely. #52885
  • Previously, cluster restores would appear in the jobs table and DB Console Jobs page as RESTORE TABLE FROM ..., which was incorrect. They now appear as RESTORE FROM .... #53230
  • Previously, CockroachDB could return incorrect results when performing LEFT ANTI hash joins when right equality columns would form a key when using the vectorized execution engine. This has been fixed. #53226
  • Admin users are now permitted to cancel other users' queries and sessions. Previously only the root user was allowed to do so. #53291
  • Fixed a possible server panic when using the nodelocal and userfile subcommands. #53359
  • Fixed a bug where user-defined types could not be used with some ORMs due to an assertion failure within Cockroach. #53385
  • The DB Console Node Map (enterprise feature) and the Advanced Debug page to list cluster localities are now again available to non-admin users. This bug had been introduced in v19.2.3. #53329
  • Previously, if no table was referencing a schema, it would not be included. Now when backing up a database, all schemas will be included. #53224
  • Fixed an internal error related to casts between tuples. #53682
  • Virtual index scans now respect limits properly, as they did in v20.1 and prior. #53529
  • CockroachDB could previously crash when evaluating queries with window functions with GROUPS mode of framing when OFFSET FOLLOWING boundary was used and when the offset was a very large value such that it could result in an integer overflow. This is now fixed. #53722
  • Database creation/deletion was previously not correctly tracked by revision_history cluster backups. This is now fixed. #53667
  • Fixed a bug that caused a crash when using a RANGE mode window function with an offset in some cases, e.g., OVER (PARTITION BY b ORDER BY a RANGE 1 PRECEDING). #53717
  • Fixed a panic in ST_SetPoint when given empty point. #53857
  • Fixed a rare internal error that could occur during planning of queries with many highly selective predicates. #53802
  • CockroachDB now properly checks that a user has CREATE privileges on the target database before allowing them to create a schema. #53837
  • CockroachDB could previously crash when performing an interleaved join in some cases. This is now fixed. The bug has only been present on v20.2 testing releases. #53863
  • Fixed "use of crdb_internal_vtable_pk column not allowed" for some queries involving virtual tables. #53866
  • Fixed a bug when running restore while upgrading the cluster from v20.1 to v20.2. #53848
  • Fixed a bug where we allowed new types to be used in an array type during a version upgrade. #53961
  • Fixed a rare bug where the optimizer incorrectly classified some columns as not-null, possibly leading to invalid query plans and incorrect results. #54024

Performance improvements

  • Maximum and minimum values, represented as 2-bucket histograms, are now collected for all non-index columns (up to 100 columns per table) as part of automatic statistics collection. 200-bucket histograrms are still collected for all index columns. This change enables the optimizer to make better cardinality estimates and may result in better query plans in some cases. #52905
  • A large heap allocation performed during INSERT statements was removed, resulting in an increase to throughput for single-row INSERT statements. #53076
  • Transient node liveness blips no longer cause up-to-date ranges to unquiesce, which makes these events less destabilizing. #51894
  • The ~ and && geospatial bounding box operations can now benefit from index acceleration if one of the operands is an indexed geometry column. #53023
  • Cleaning up after a failure during IMPORT INTO a table which was empty is now faster. #52754
  • The allocation algorithm now supports intra-node rebalances, which means CockroachDB can fully utilize the additional stores on the same node. This removes the last roadblock to running CockroachDB with multiple stores (i.e., disks) per node. #51567
  • Validation of optimistic reads is now performed earlier in transactions when doing so can save work. This eliminates certain types of transaction retry errors and avoids wasted RPC traffic. #52884
  • Fixes a performance regression introduced in v20.2 alpha releases where the use of 2-part names to specify tables or types would incur extra reads from the store on every transaction. #53290
  • The optimizer can now convert semi joins to inner joins in more cases, which may allow the optimizer to produce more efficient query plans. #53337
  • The optimizer is now aware that the inverted join operator can preserve the ordering of its input. This enables the optimizer to eliminate unnecessary sort operations and produce more efficient plans in some cases. #53502
  • The optimizer reduces filters applied after partial index scans in more cases where the filters are implicitly applied by the partial index predicate. This could lead to more efficient query plans in some cases. #53507
  • Limited the frequency of an expensive operation due to schema changes. This makes workloads that perform schema changes at a high rate less resource-intensive. #53605
  • Joins between very small tables are now more likely to use lookup join. #53849

Doc updates

Contributors

This release includes 283 merged PRs by 40 authors. We would like to thank the following contributors from the CockroachDB community:

  • Cyrus Javan (first-time contributor)
  • Deven Bhooshan (first-time contributor)
  • Erik Grinaker (first-time contributor)
  • Michael Meng (first-time contributor)
  • Themis Papavasileiou (first-time contributor)
  • Vincent Xiao
  • himanshuchawla009
YesYes NoNo