December 8, 2020
Get future release notes emailed to you:
Downloads
Docker image
$ docker pull cockroachdb/cockroach-unstable:v21.1.0-alpha.1
Backward-incompatible changes
- Rows containing empty arrays in
ARRAY
columns are now contained in inverted indexes. This change is backward-incompatible because prior versions of CockroachDB will not be able to recognize and decode keys for empty arrays. Note that rows containingNULL
values in an indexed column will still not be included in inverted indexes. #55970 - Concatenation between a non-null argument and a null argument is now typed as string concatenation, whereas it was previously typed as array concatenation. This means that the result of
NULL || 1
will now beNULL
instead of{1}
. To preserve the old behavior, the null argument can be casted to an explicit type. #55611
General changes
- Added increased logging and metrics around slow disk operations. #54215
- CockroachDB now detects stalled disk operations better and crashes the process if a disk operation is taking longer than a minute. Added cluster settings to allow for tuning of this behavior. #55186
- Added some metrics surrounding schema changes. #54855
- RocksDB can no longer be used as the storage engine. Passing in
--storage-engine=rocksdb
now returns an error. #55509 - Upgraded CockroachDB's version of Go to v1.15.4. #56363
- The timezone data is now built in to the CockroachDB binary, which is the fallback source of time if
tzdata
is not located by the default Go standard library. #56634 - Renamed instances of "Admin UI" to "DB Console" in the documentation of OIDC cluster settings. #56869
- Included
tar
in docker images. This allows users to usekubectl cp
on 20.2.x containers. #57241
Enterprise edition changes
- It is no longer allowed to widen an incremental-backup chain with the inclusion of new complete empty DBs. #54329
- Added cluster settings to enable/ disable the
BACKUP
andRESTORE
commands. Attempts to use these features while they are disabled returns an error indicating that the database administrator has disabled the feature. Example usage:SET CLUSTER SETTING feature.backup.enabled = FALSE; SET CLUSTER SETTING feature.backup.enabled = TRUE; SET CLUSTER SETTING feature.restore.enabled = FALSE; SET CLUSTER SETTING feature.restore.enabled = TRUE;
. #56533 - Added cluster settings to enable/ disable the
IMPORT
,EXPORT
, and changefeed commands. Attempts to use these features while they are disabled returns an error indicating that the database administrator has disabled the feature. Example usage:SET CLUSTER SETTING feature.import.enabled = FALSE; SET CLUSTER SETTING feature.import.enabled = TRUE; SET CLUSTER SETTING feature.export.enabled = FALSE; SET CLUSTER SETTING feature.export.enabled = TRUE; SET CLUSTER SETTING feature.changefeed.enabled = FALSE; SET CLUSTER SETTING feature.changefeed.enabled = TRUE;
. #56872
SQL language changes
- Interleaved joins have been removed; merge joins are now planned in all cases when interleaved joins would have been planned previously. #54163
- It is now possible to create partial inverted indexes. The optimizer will choose to scan partial inverted indexes when the partial index predicate is implied and scanning the inverted index has the lowest estimated cost. #54376
EXPLAIN ANALYZE
diagrams now contain "bytes sent" information on streams. #54518- Implemented the geometry built-in functions
ST_Rotate({geometry, float8, geometry})
. #54610 - Implemented the geometry built-in function
ST_ClosestPoint()
. #54843 - Implement the string built-in function
unaccent()
. #54628 - When enterprise features are not enabled, the
follower_read_timestamp()
function now returns(statement_time - 4.8s)
instead of an error. #54951 - Added a new virtual table
crdb_internal.invalid_descriptors
, which runs validations on descriptors in the database context and reports any errors. #54017 - Implemented the built-in operator
add jsonb_exists_any(jsonb, text[])
. #55172 - Added the ability to optionally specify the
PRIVILEGES
keyword when issuing theGRANT ALL
orREVOKE ALL
statements, for Postgres compatibility. Previously, a statement like the following would fail with a syntax error:GRANT ALL PRIVILEGES ON DATABASE a TO user1;
. #55304 - Implemented the built-in function
pg_column_size()
, which counts the amount of bytes stored by column. #55312 - Implemented the geometry built-in functions
ST_Rotate({geometry, float8, float8, float8})
. #55428 - Implemented the built-in function
ST_MemSize()
, which returns the memory space a geometry takes. #55416 SHOW ENUMS
now returns an array aggregation of enum values instead of having them separated by the|
character. #55386- Implemented the geometry built-in function
ST_PointInsideCircle()
. #55464 - Implement the geometry built-in function
ST_LineFromEncodedPolyline()
. #55429 - Implement the geometry built-in function
ST_AsEncodedPolyline()
. #55515 - Implement the geometry built-in function
ST_LineLocatePoint()
, which computes the fraction of the line segment that represents the location of the given point to the closest point on the original line. #55470 - Implemented the
REASSIGN OWNED BY ... TO ...
statement, which changes ownership of all database objects in the current database, owned by any roles in the first argument, to the new role in the second argument. #54594 - Implemented the geometry built-in function
ST_MinimumBoundingRadius()
, which returns a record containing the center point and radius of the smallest circle that can fully contain a geometry. #55532 - The vectorized engine now supports the JSONFetchValPath (
#>
) operator. #55570 - Added the ability to cast a string containing all integers into a given regtype, e.g.
'1234'::regproc
. #55607 - Potentially hazardous
DROP COLUMN
operations whensql_safe_updates
is enabled now return a note and link to https://github.com/cockroachdb/cockroach/issues/46541. #55248 - Changed the
SPLIT AT
output to be consistent with the output fromSHOW RANGES
. #55543 - Implemented the geometry built-in function
ST_MinimumBoundingCircle()
, which returns polygon shape that approximates minimum bounding circle to contain geometry. #55567 - Added the constraint name to constraint errors, for increased wire-level Postgres compatibility. #55660
- Added support for using the syntax
... UNIQUE WITHOUT INDEX ...
inCREATE TABLE
andALTER TABLE
statements, both when defining columns and unique constraints. Although this syntax can now be parsed successfully, using this syntax currently returns an error:unique constraints without an index are not yet supported
. #55700 - Add the built-in functions
sha224()
andsha384()
. #55720 - Implemented
SHOW REGIONS
, which returns all of regions available in a cluster. #55831 - Implemented the geography built-in function
ST_UnaryUnion()
#55894 - Implemented
ALTER TABLE ... SET LOCALITY/REGIONAL AFFINITY
statements, which configure multi-region properties of given tables. These are subject to change. #55827 - All expressions in
EXPLAIN
output that operate on indexes now show the table name the index is declared on, rather than just an alias. If the query aliases the table, the alias is also shown. For example, a scan on tablefoo
that is aliased asf
was previously displayed asscan f
. It is now displayed asscan foo [as=f]
. #55641 - Changed the underlying type for the version cluster setting. Previously, it was of an internal type representing "state machine", but now it's simply "version". This has no operational implications, but the
Type
column incockroach gen settings-list
now shows "version" instead of "custom validation". #55994,#56546 - Removed the
201auto
value for thevectorize
session variable and the corresponding cluster setting. #55907 - Expanded the
CREATE SCHEMA
,DROP SCHEMA
,ALTER SCHEMA
,GRANT ... ON SCHEMA
,REVOKE ... ON SCHEMA
, andSHOW GRANTS ON SCHEMA
statements to allow schema names prefixed with database names. #55647 - Added support for dollar-quoted strings with digit. #55958
- Added a new single-column output format for
EXPLAIN
andEXPLAIN (VERBOSE)
. #55866 - Creating multi-column inverted indexes is now allowed by setting the
experimental_enable_mutlti_column_inverted_indexes
session setting totrue
. At this time, these indexes are not fully supported and their behavior is undefined. Using this feature will likely result in errors. Do not enable this setting in a production database. #55993 - Constraints that have not been validated are now marked "NOT VALID" in the output of
SHOW CREATE
andSHOW CONSTRAINTS
. #53485 - The
NOT VALID
option can now be provided forCHECK
andFOREIGN KEY
constraints listed as table constraints inCREATE TABLE
statements. This option has no affect on the constraint created. It will not skip validation. #53485 - Added a pgcode (
42704
,undefined_object
) to the error returned when attempting to drop an index by a table and index name that doesn't exist. #55417 - Added the
WITH row_limit="{$num}"
option for importing CSVs to allow users to do a quick test run on an import of$num
rows. Exampel:IMPORT TABLE test ... CSV DATA ... WITH row_limit="3";
#56080 - Added the
WITH row_limit="{$num}"
option for importingDELIMITED/AVRO
data to allow users to do a quick test run on an import of $num rows. Example:IMPORT TABLE test ... DELIMITED/AVRO DATA ... WITH row_limit="3";
#56135 - Added
WITH row_limit="{$num}"
option for importing bundle formats to allow users to do a quick test run on an import of $num rows. Example:IMPORT ... WITH row_limit="3";
. #56587 EXPLAIN ANALYZE
diagrams now contain "network latency" information on streams. #55705- Implemented the
covar_pop()
andcovar_samp()
aggregation functions. #55707 - Prevented column type modification of columns that are depended on by views. #56213
- Implemented the geometry built-in functions
ST_TransScale({geometry,float8,float8,float8,float8})
#56198 - Implemented the geometry built-in function
ST_Node()
. #56183 - The concatenation operator
||
can now be used between strings and any other non-array types. #55611 - CockroachDB now returns a float instead of a decimal when at least one argument of an aggregate function is decimal. #56296
- Implemented the
regr_intercept()
,regr_r2()
, andregr_slope()
aggregation functions. #56296 EXPLAIN ANALYZE
diagrams now show "deserialization time" on streams instead of "io time". #56144- Added a pgcode (
42804
,DatatypeMismatch
) when adding a default value of the wrong type to a column. #56455 - Attempting to rename an undefined index now returns a
pgcode.UndefinedObject
(42704
) error instead of an uncategorized error. #56455 - Implemented the
regr_sxx()
,regr_sxy()
, andregr_syy()
aggregation functions. #56585 SHOW REGIONS
has changed the column name for availability zones to "zones" from "availability_zones". #56344- Introduced a
pg_collation
of "default". Strings now return the "default" collation OID in thepg_attribute
table (this was previouslyen_US
). The "default" collation is also visible on thepg_collation
virtual table. #56598 - A table can now successfully be dropped in a transaction following other schema changes to the table in the same transaction. #56589
- Added a new variant of explain:
EXPLAIN ANALYZE (PLAN)
. #56524 SHOW REGIONS
functionality is now deferred toSHOW REGIONS FROM CLUSTER
. #56627- It is now possible to hint to the optimizer that it should plan an inverted join by using the syntax
... INNER INVERTED JOIN ...
or... LEFT INVERTED JOIN ...
. If the hint is provided and it is possible to plan an inverted join, the optimizer will now plan an inverted join, even if it estimates that a different plan would have a lower cost. If the hint is provided but it is not possible to plan an inverted join because there is no inverted index on the right side table or the join condition is not a valid inverted join condition, the database will return an error. #55679 - Added the empty
pg_catalog.pg_opclass
table to improve compatibility with Postgres. #56653 SURVIVE AVAILABILITY ZONE FAILURE
is nowSURVIVE ZONE FAILURE
. #56837- Added admin-only,
crdb_internal
functions to enable descriptor repair in dire circumstances. #55699 - Added support for an optional
=
character forSURVIVE
, e.g.ALTER DATABASE d SURVIVE = ZONE FAILURE
. #56881 - Introduced stubs for
ALTER DATABASE ... PRIMARY REGION
andCREATE TABLE ... PRIMARY REGION
. #56883 - Dropping the primary index using
DROP INDEX
now returns aFeatureNotSupported
error along with hints showing supported ways to drop primary indexes. #56858 - Renaming an index to a name that is already being used for another index will now return a
pgcode.DuplicateRelation
(42P07
) error instead of an uncategorized error. #56681 - The
relpersistence
column inpg_catalog.pg_class
now correctly displayst
as the persistence status for temporary tables. #56827 - Added a deprecation notice to statements containing the
INTERLEAVE IN PARENT
clause. #56874 SHOW DATABASES
andcrdb_internal.databases
now display all regions as well as survival goals for a given database. #56880- Adds a feature flag via cluster settings for the
CREATE STATISTICS
andANALYZE
feature. If a user attempts to use the command while disabled, an error indicating that the database administrator had disabled the feature is surfaced. Example usage:SET CLUSTER SETTING feature.stats.enabled = FALSE; SET CLUSTER SETITNG feature.stats.enabled = TRUE;
. #57076 CREATE DATABASE ... PRIMARY REGION
is now stored on the database descriptor. #57038SHOW DATABASES
andcrdb_internal.databases
now display thePRIMARY REGION
set on the database descriptor as theprimary_region
column. #57038- Added a feature flag via cluster settings for all schema change-related features. If a user attempts to use these features while they are disabled, an error indicating that the database administrator has disabled the feature is surfaced. Example usage:
SET CLUSTER SETTING feature.schema_change.enabled = FALSE; SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
. #57040 - Changed
pg_constraint
column types forconfkey
andconkey
tosmallint[]
to improve compatibility with Postgres. #56975 - The
ALTER TABLE...SPLIT/UNSPLIT
andALTER INDEX...SPLIT/UNSPLIT
commands are now gated by a schema change feature flag. If a user attempts to use these features while they are disabled, an error indicating that the system administrator has disabled the feature is surfaced. Example usage:SET CLUSTER SETTING feature.schema_change.enabled = FALSE SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
. #57142 - When creating a database with the regions clause specified, CockroachDB now creates a
regions
enum type automatically. #56628 - Implemented
SHOW REGION FROM DATABASE
andSHOW REGION FROM DATABASE db
, which shows all regions for the given database, as well as whether that region is the primary region. #57106 CREATE TABLE AS SELECT ... FROM ... AS OF SYSTEM TIME x
is now supported. #55916- Implemented the function
regr_count()
. #56822 - Added the
character_sets
table to theinformation_schema
. #56953 SHOW ENUMS
is now extended to take an optionalFROM
clause. The user can specify either the schema name or both the database name and schema name separated by.
. If a hierarchy is specified, the statement returns enums falling in that hierarchy rather than all of the enums in the current database. #57197- The multi-region enum, created implicitly for all multi-region databases, can be introspected using the
pg_catalog.pg_enum
table. It is also displayed inSHOW ENUMS
. #57197 - Implemented the geography built-in function
ST_Subdivide()
. #56898 - A
pgcode.UndefinedColumn
error is now returned when adding a unique constraint to one or more undefined columns. #57316 - The database name is now displayed in
SHOW REGIONS FROM DATABASE
. #57278 - Added
SHOW SURVIVAL GOAL FROM DATABASE [database]
, which shows the survival goal for a multi-region database. #57278 - Added the
uuid_generate_v4()
built-in function. It works exactly likegen_random_uuid()
but was added for compatibility with Postgres versions older than PG13. #57212
Command-line changes
- A
debug.zip
file now includes a script,hot-ranges.sh
, which will summarize the hottest ranges in the cluster. #53547 cockroach sql
andcockroach demo
now support the command-line parameter--input-file
(shorthand-f
) to read commands from a named file. The behavior is the same as if the file was redirected on the standard input; in particular, the processing stops at the first error encountered (which is different from interactive usage with a prompt). Note that it is not yet possible to combine-f
with-e
. #54741- The large banner message "Replication has been disabled for this cluster ..." that was unconditionally emitted on the standard error stream for
cockroach start-single-node
has now become a simple log message at severityINFO
. #54749 cockroach demo
now pre-creates ademo
user account with a random password to discourage the user ofroot
. Thedemo
account is currently granted theadmin
role. #54749- The CLI help text for
--max-disk-temp-storage
now properly reports the default value. #54853 - The help text displayed by
\?
incockroach sql
andcockroach demo
now groups the recognized client-side commands into sections for easier reading. #54796 - The client-side command
\show
for the SQL shell is deprecated in favor of the new command\p
. This prints the contents of the query buffer entered so far. #54796 - The new client-side command
\r
for the SQL shell erases the contents of the query buffer entered so far. This provides a convenient way to reset the input, for example, when the user gets themselves confused with string delimiters. #54796 - The SQL shell (
cockroach sql
,cockroach demo
) now supports the client-side command\echo
, likepsql
. This can be used, for example, to generate informational output when executing SQL scripts non-interactively. #54796 - The SQL shell (
cockroach sql
,cockroach demo
) now support the\i
and\ir
client-side command which reads SQL file and evaluates its content in-place.\ir
differs from\i
in that the file name is resolved relative to the location of the script containing the\ir
command. This makes\ir
likely more desirable in the general case. Instances of\q
inside a file included via\i
/\ir
stop evaluation of the file and resume evaluation of the file that included it. This feature is compatible with the identically namedpsql
commands. It is meant to help compose complex initialization scripts from a library of standard components. For example, one could be defining each table and its initial contents in separate SQL files, and then use different super-files to include different tables depending on the desired final schema. #54796 - Removed the
debug sstables
command, superseded by thedebug pebble lsm
command. #54890 - Added the
cockroach debug pebble db checkpoint
debug command to easily create a checkpoint without using rocksdb. #55751 - Updated the
--storage-engine
help text to reflect RocksDB deletion. #55509 - Added support for
\connect DATABASE
and\c DATABASE
. #55934 - Added an import CLI command that allows users to upload and import local dump files into a running cockroach cluster.
PGDUMP
andMYSQLDUMP
formats are currently supported. #54896 cockroach demo
now allows for nodes to be added using the\demo
client-side command. This works in both single node and multi-node configurations, for example, when started with--nodes int
or--geo-partitioned-replicas
. #56344Some specific situations now have dedicated exit status codes. The following codes are defined:
Code Description 0 Process terminated without error. 1 An unspecified error was encountered. Explanation should be present in the stderr or logging output. 2 Go runtime error, or uncaught panic. Likely a bug in CockroachDB. Explanation may be present in logging output. 3 Server process interrupted gracefully with Ctrl+C / SIGINT. 4 Command-line flag error. 5 A logging operation to the process' stderr stream failed (e.g. stderr has been closed). Some details may be present in the file output, if enabled. 6 A logging operation to file has failed (e.g. log disk full, no inodes, permission issue, etc). Some details may be present in the stderr stream. 7 Server detected an internal error and triggered an emergency shutdown. 8 Logging failed while processing an emergency shutdown. cockroach demo
now tries to use the same TCP port numbers for the SQL and HTTP servers on every invocation. This is meant to simplify documentation. These defaults can be overridden with the new (demo
-specific) command line flags--sql-port
and/or--http-port
. #56737The SQL shell now accepts
yes
/no
as boolean options for slash commands, followingpsql
behavior. #56829A
\x [on|off]
command has been added to toggle therecords
display format, followingpsql
behavior. #56829CockroachDB now prints a warning if the
--locality
flag does not contain a "region" tier. #57179
API endpoint changes
- Added a new prometheus metric called
seconds_until_license_expiry
that reports the number of seconds until the enterprise license on the cluster expires, a negative number if the expiration is in the past, or0
if there is no license. #55565
DB Console changes
- Changed the view for tables without data on main pages. #54943
- Updated the design of the custom date range selector on the Cluster > Maps view and Metrics pages #54851
- The DB Console now shows messages provided by server instead of custom generic messages defined on the client side, for example, messages about permission restrictions to show pages for non-admin roles. #50869
- Added a new metric called
raft.scheduler.latency
, which monitors the latency for operations to be picked up and processed by the Raft scheduler. #56943 - Redesigned inline error alerts when a user has insufficient rights to see some resources. #50869
- Implemented a permission denied error for non-admin users on the Node Map and Events views. #50869
- Tables within user-defined schemas are now included in the Data Distribution page. #56388
- Creating, dropping, and altering roles or users now causes events to be logged and displayed. #55945
- If statement diagnostics are enabled for a statement, the bytes sent over the network are now shown. #55969
ALTER DATABASE OWNER
andCONVERT TO SCHEMA
now cause events to be logged and displayed. #55891- Changing schema objects now causes events to be logged and displayed. #55785
- Changing privileges (i.e., with
GRANT
orREVOKE
) now causes events to be logged and displayed. #55612 - Renaming databases or tables now causes events to be logged and displayed. #55269
- Added descriptions for failed job on the Job Details page. #54268
Bug fixes
- Fixed the
rpath
andso
names oflibgeos.so
andlibgeos_c.so
such that adlopen
tolibgeos.so
is not needed. #55129 - Made lease transfers during rebalancing adhere to the rate limit utilized in other lease transfer cases which eliminates unexpected lease oscillations when adding a new node. #54322
- CockroachDB now handles PostgreSQL "cancel" messages on TLS connections in the same way as when they are sent without TLS: the connection is closed, but no action takes place. No error is logged. As a reminder, PostgreSQL "cancel" messages are still unsupported in CockroachDB and client should still use
CANCEL QUERY
instead. #54618 - Cleared table statistics from job description in failed and canceled backup jobs. #54446
- Fixed an error message that referred to
experimental_enable_hash_sharded_indexes
as a cluster setting when it is in fact a session variable. #54960 - Fixed a nil pointer error that could occur at planning time for some spatial queries when an inverted index existed on a geometry or geography column. #55076
- Fixed
SHOW ENUMS
column names to havevalues
instead ofstring_agg
for column names, andowner
for the owner itself. #55139 - Fixed
SHOW TYPES
to show theowner
column instead of thevalue
column. #55139 - Fixed a bug where empty enums did not show up for
SHOW ENUMS
orSHOW TYPES
. #55143 - Fixed a bug where, on failure of
CREATE TABLE AS
orCREATE MATERIALIZED VIEW
, tables would be left in an invalid non-public state until GC instead of being marked as dropped, possibly causing spurious validation failures. The bug was introduced in earlier 20.2 pre-releases. #55272 - Fixed a rare scenario in which a node would refuse to start after updating the binary. The log message would indicate:
store [...], last used with cockroach version [...], is too old for running version [...] (which requires data from [...] or later)
. #55240 - Changefeeds defined on multiple tables will now only backfill affected tables after a schema change. #55135
- Fixed a bug where adding child tables or types to a schema being restored would cause those new child objects to become corrupted with no parent schema if the restore job had to be rolled back. #55157
- Fixed a bug where the seconds component of a zone offset of a
TIMESTAMPTZ
value was not displayed. #55071 - Fixed a bug where casts to regclass were not escaped, e.g., when the type or table name had
"
characters. #55607 - Fixed a bug where casts from string to regproc, regtype or regprocedure would not work if they contained
"
characters at the beginning or at the end. #55607 - Fixed a bug which could cause
IMPORT
,BACKUP
, orRESTORE
to experience an error when they occur concurrently to when the cluster sets its version to upgraded. #55524 - Fixed a rare crash during tracing when reading un-decodable data. #55783
- Prevented a crash, introduced in the 20.2 series, caused by range scans over virtual tables with virtual indexes. #56459
- In some cases CockroachDB, would attempt to transfer ranges to nodes in the process of being decommissioned or being shut down; this could cause disruption the moment the node did actually terminate. This bug has been fixed. It had been introduced some time before v2.0. #55808
- Fixed a bug causing queries sent to a freshly-restarted node to sometimes hang for a long time while the node catches up with replication. #55148
- Fixed typing of collated strings so that collation names are case-insensitive and hyphens/underscores are interchangeable. #56352
- Fixed internal errors related to very large
LIMIT
and/orOFFSET
values. #56672 - Improved the accuracy of reported CPU usage when running in containers. #56461
- Fixed a bug which can lead to canceled schema change jobs ending in the failed rather than canceled state. #55513
- Prevented an opportunity for livelock in the jobs subsystem due to frequent updates to already finished jobs. #56855
- The
LogFile
reserved API, which was used bycockroach debug zip
, could corrupt log entries. This has been fixed. #56901 DELETE
statements no longer have a chance of returning an incorrect number of deleted rows in transactions that will eventually need to restart due to contention. #56458- Fixed a race condition in the
tpcc
workload with the--scatter
flag where tables could be scattered multiple times or not at all. #56942 - Fixed a bug where reg* types were not parsed properly over pgwire,
COPY
or prepared statements. #56298 - Previously, casts and parsing of strings to types could allow an out-of-bounds value to be successfully used (e.g.,
SELECT -232321321312::int2
) but fail with an out-of-bounds message when it is inserted into the table. This is now checked when the value is parsed or being casted to. #55095 cockroach debug merge-logs --redact=true --redactable-output=false
now properly removes redaction markers. #57121- Fixed a bug related to validation of un-upgraded pre-19.2 inbound foreign keys. #57132
- Creating a materialized view that references a column with a NULL value no longer results in an error. #57139
ST_GeomFromGeoJSON
now sets the SRID to 4326, matching PostGIS 3.0 / RFC7946 behavior. #57152- Fixed a bug that caused an "ambiguous column reference" error during foreign key cascading updates. This error was incorrectly produced when the child table's reference column name was equal to the concatenation of the parent's reference column name and "_new", and when the child table had a
CHECK
constraint, computed column, or partial index predicate expression that referenced the column. This bug was introduce in version 20.2. #57153 - Fixed a bug that caused errors or corrupted partial indexes of child tables in foreign key relationships with cascading
UPDATE
s andDELETE
s. The corrupt partial indexes could result in incorrect query results. Any partial indexes on child tables of foreign key relationships withON DELETE CASCADE
orON UPDATE CASCADE
actions may be corrupt and should be dropped and re-created. This bug was introduce in version 20.2. #57100 - Second timezone offsets for
TIMETZ
now correctly display over the Postgres wire protocol; these were previously omitted. #57265 SELECT FOR UPDATE
now requires bothSELECT
andUPDATE
privileges, instead of justUPDATE
privileges. #57309- Fixed a bug where users of an OSS build of CockroachDB would see "Page Not Found" when loading the DB Console. #56591
Performance improvements
- The optimizer can now deduce that certain variable arguments to functions must be non-null. This improves cardinality estimation for those variables and unlocks other types of optimizations. As a result, the optimizer may choose better query plans when a function is used as a filter predicate. #54558
- Improved the selectivity estimate for array contains predicates (e.g.,
arr @> ARRAY[1]
) in the optimizer. This improves the optimizer's cardinality estimation for queries containing these predicates, and may result in better query plans in some cases. #54768 - Updated the cost model in the optimizer to make index joins more expensive and better reflect the reality of their cost. As a result, the optimizer will choose index joins less frequently, generally resulting in more efficient query plans. #54768
- The optimizer simplifies join expressions to only scan a single table when the join filter is a contradiction. A limitation, now removed, was preventing this simplification from occurring in some cases, leading to more efficient query plans in some cases. #54813
- Improved the efficiency of plans for the execution of left outer spatial joins. #55216
- The optimizer now considers partial indexes when exploring zigzag joins. This may lead to more efficient query plans for queries that (1) operate on tables with partial indexes and (2) have a filter that holds two columns, indexed by two indexes, constant. #55401
- The optimizer now attempts to split a query with a disjunctive filter (OR expression) into a UNION of index scans, where one or both of the scans is an unconstrained partial index scan. As a result, more efficient query plans may be generated for queries with disjunctive filters that operate on tables with partial indexes. #55915
- CSV imports should now be slightly faster. #55845
- Previously, all
CHECK
constraints defined on a table would be tested for everyUPDATE
to the table. Now, a check constraint will not be tested for validity when the values of columns it references are not being updated. The referenced columns are no longer fetchecd in cases where they were only fetched to testCHECK
constraints. #56007 - Indexes on computed columns can now be utilized when filters reference the computed expression and not the computed column directly. #55867
- The query optimizer can now generate inverted zigzag joins over partial inverted indexes. This may lead to more efficient query plans when filtering by a column that is indexed by a partial inverted index. #56101
- They query optimizer can now plan zigzag joins on two partial indexes with the same predicate, leading to more efficient query plans in some cases. #56103
- The optimizer now converts inner joins with single-row values expressions into projections. This allows decorrelation of subqueries that only reference variables from the outer query, such as
SELECT (SELECT value + 10) FROM table
. #55961 - The optimizer may now plan an inverted join if two tables are joined on
JSONB
orARRAY
columns using a contains predicate (e.g.,WHERE a @> b
), and the first column has an inverted index. The inverted join will be chosen if the optimizer expects it to be more efficient than any alternative plan. For queries in which the only alternative is a cartesian product followed by a filter, the inverted join will likely result in a performance improvement. #55679 - The hybrid logical clock used to coordinate distributed operations now performs significantly better under high contention with many concurrent updates from remote nodes. #56708
- The Raft processing goroutine pool's size is now capped at 96. This was observed to prevent instability on large machines (32+ vCPU) in clusters with many ranges (50k+ per node). #56860
- Interactions between Raft heartbeats and the Raft goroutine pool scheduler are now more efficient and avoid excessive mutex contention. This was observed to prevent instability on large machines (32+ vCPU) in clusters with many ranges (50k+ per node). #56860
- The Raft scheduler now prioritizes the node liveness Range. This was observed to prevent instability on large machines (32+ vCPU) in clusters with many ranges (50k+ per node). #56860
- The optimizer now supports using an inverted index on
JSONB
orARRAY
columns for a wider variety of filter predicates. Previously, inverted index usage was only supported for simple predicates (e.g.,WHERE a @> '{"foo": "bar"}'
), but now more complicated predicates are supported by combining simple contains (@>
) expressions withAND
andOR
(e.g.,WHERE a @> '{"foo": "bar"}' OR a @> '{"foo": "baz"}'
). An inverted index will be used if it is available on the filtered column and the optimizer expects it to be more efficient than any alternative plan. This may result in performance improvements for queries involvingJSONB
andARRAU
columns. #56732
Doc updates
- Updated several Hello World tutorials to use
cockroach demo
as the backend and an external repository for code samples, including Go with pgx, pq, and GORM, Java with JDBC and Hibernate, and Python with psycopg2, SQLAlchemy, and Django. #9025,#8991, - Updated the Production Checklist to recommend disabling Linux memory swapping to avoid over-allocating memory. #8979
Contributors
This release includes 1040 merged PRs by 88 authors. We would like to thank the following contributors from the CockroachDB community:
- Adrian Popescu (first-time contributor)
- Alan Acosta (first-time contributor)
- ArjunM98 (first-time contributor)
- Artem Barger
- Azdim Zul Fahmi (first-time contributor)
- David Pacheco (first-time contributor)
- Erik Grinaker
- Gabriel Jaldon (first-time contributor)
- Jake Rote (first-time contributor)
- Joshua M. Clulow (first-time contributor)
- Marcin Knychała (first-time contributor)
- Max Neverov (first-time contributor)
- Miguel Novelo (first-time contributor)
- Ruixin Bao (first-time contributor)
- TAKAHASHI Yuto (first-time contributor)
- Tayo (first-time contributor)
- Tim Graham (first-time contributor)
- Tom Milligan (first-time contributor)
- Vaibhav
- alex-berger@gmx.ch (first-time contributor)
- alex.berger@nexiot.ch (first-time contributor)
- haseth (first-time contributor)
- hewei03 (first-time contributor)
- neeral
- xinyue (first-time contributor)