Announcing CockroachDB 20.2: Build more, deploy easier, innovate faster

Last edited on November 10, 2020

0 minute read

    Here at Cockroach Labs, we want to arm you with tools you need to build better products, deliver better customer experiences, and maybe even create the next billion-dollar idea. Our goal with CockroachDB is to make it easier for any and every developer to deliver data-intensive applications, allowing them to easily take advantage of high availability and elastic scale.

    With our latest release, CockroachDB 20.2, we have added updates to make developers even more productive with a broader range of workloads. We’ve also continued to improve the security and management capabilities of the database and, as always, have made considerable improvements to the performance of CockroachDB. With this release we are also incredibly happy to note that the majority of these new capabilities are available in our free option, CockroachDB Core.

    With CockroachDB 20.2 you can now:

    As a general-purpose, distributed SQL database, CockroachDB is the right choice for any data-intensive application. The updates in 20.2 expand CockroachDB’s support to more workloads and give access to more developers. We’re excited to see what you build!

    Read on for more details, then head over to the 20.2 Docs for a full list of what’s new. Note that all features mentioned in this blog post are available for free in our open-source option. If you want to try out CockroachDB 20.2 yourself, you can download the release here or try it for free on CockroachDB Dedicated.

    Build more with CockroachDB 20.2

    In 20.2, we focused on giving developers more tools, so they can build more types of applications and realize the full potential of those applications.

    Spatial data types and indexing in CockroachDB
    pasted image 0

    Spatial data powers some of the world’s most innovative apps and services, letting you answer questions like, “Where’s the nearest gas station?” and “How long will it take for my ride-sharing vehicle to arrive?” and even, “Where can I catch a Pokémon?” The only problem is, this data has been locked away in brittle legacy or separate specialized databases, making it difficult for developers to support large datasets in the cloud.

    With 20.2, we give spatial data the same first-class treatment as other data types, bringing it into the cloud age and making it easier to develop applications that use it. CockroachDB is the first SQL database to build this functionality from the ground up for a distributed environment. This means you can now effortlessly scale your spatial data and have the confidence it will survive outages. And you can serve all your customers with fast, always-on experiences no matter where they are on the globe.

    CockroachDB now supports the following, all of which are open-source, available for free, and accessible with PostGIS-compatible SQL:

    New transactions and sessions pages in the DB Console


    Our DB Console (formerly Admin UI) displays metrics like SQL performance, network traffic, and storage capacity and is critical for troubleshooting and debugging. CockroachDB 20.2 adds two new pages to help developers introspect and understand query performance:

    • Sessions Page: See live database sessions, and cancel them easily from the DB Console. For a given session, you can see whether there’s a live transaction, which statements are currently running, and how long sessions have been running.

    • Transactions Page: See historical SQL transactions and the statements that comprise them, so you can better understand application performance. This is in addition to the existing statements page, which lets you troubleshoot individual statements.

    Additional SQL functionality in CockroachDB 20.2

    CockroachDB is wire compatible with PostgreSQL and delivers standard SQL syntax, so you can use our database as your next generation relational store. In 20.2, we’ve improved our SQL capabilities adding:

    • User-Defined Schemas: Structure your data hierarchy with schemas, which are commonly used in relational databases including PostgreSQL. This update makes CockroachDB more familiar for developers, more compatible with PostgreSQL applications and tools, and more flexible in its support for different data isolation patterns such as microservices.

    • Partial Indexes: Index only the subset of rows needed for fast reads. More precise indexing reduces the amount of data stored by your indexes and therefore the performance impact on writes to data that does not need to be indexed.

    • Materialized Views: Reduce costs for frequently-run queries by caching query results in-memory and only updating when necessary.

    • Enumerated types (ENUMs): With this popular data type, you can restrict inputs to a defined set of values like a drop-down list.

    • Improved performance of Foreign Keys: As a crucial component of relational databases, foreign keys protect data integrity by creating references between two tables to ensure the entry into one table is a valid entry into the other. In 20.2, performance improvements in foreign keys will let more customers use them.

    Better support for Java and Ruby in CockroachDB 20.2

    CockroachDB supports a variety of popular data access tools, including ORMs, making it easier to develop in your preferred programming language. Specifically, for 20.2 we improved support for Java by adding better compatibility with Hibernate, MyBatis, and Spring Data JDBC; and Ruby by adding compatibility with Active Record. We also built out an adaptor for the Go data access layer upper/db.

    Many thanks to all the community developers who collaborated with us on these projects. Don’t hesitate to let us know in Slack if there’s a tool you wish CockroachDB supported, or if you’d like to collaborate on building out support!

    Improved database performance in CockroachDB 20.2


    As with every release we are committed to constantly improving CockroachDB’s performance and we’ve made significant advances with 20.2.

    • TPC-C: CockroachDB passes 140,000 warehouses at 1.7M transactions / minute: TPC-C is the industry standard transactional database benchmark, simulating an e-commerce environment. We’ve written a lot about TPC-C in the past as we think it is the best measure of OLTP database workloads. CockroachDB 20.2 passed TPC-C with a maximum volume of 140k warehouses (previously we reported 100K)and a maximum throughput of 1.7M transactions per minute (tmpC), which represents a 40% performance improvement over the past year.

    • TPC-H: CockroachDB decreased query latencies on 20 of 22 queries: We also ran TPC-H, which extends our benchmarking work with complex analytic queries. While CockroachDB is primarily a transaction-oriented database, it can also perform complex joins and aggregations that are best measured through a benchmark like TPC-H. On the TPC-H benchmark, we saw a decrease in query latency for 20 out of the 22 queries with query 9 latency improving by 80x.

    Deploy easier with CockroachDB 20.2

    Your database should make you more efficient, not slow you down and 20.2 introduces updates to let you more seamlessly deploy and manage CockroachDB—both with an Enterprise license and for free.

    Introducing CockroachDB on Kubernetes

    CockroachDB is already the easiest database to run with Kubernetes—indeed, it is the only database architected and built from the ground up to deliver on the core distributed principles of atomicity, scale and survival. This means you can manage your database in Kubernetes, rather than alongside it. And hundreds of our customers are doing just that.Today we’re introducing CockroachDB on Kubernetes, a version of our distributed database that packages up CockroachDB with our brand new, open-source Kubernetes Operator. We’ve learned a whole lot about Kubernetes over the past few years by using it for our own database-as-a-service, CockroachDB Dedicated and we’ve packaged many of these learnings into an open-source Kubernetes Operator. This offering makes CockroachDB even easier to deploy on Kubernetes,With CockroachDB on Kubernetes, you get a truly cloud-native database plus automated management and best practices with our new Operator:

    • Deployment: Deploy with an operator that handles cluster securing (certs) and configuration (persistent volume size, number of CockroachDB nodes, and more).

    • Management: Simply scale your cluster up and down on pods in Kubernetes without any manual manipulation of the data. Add a node (or remove a node) by spinning it up in a pod and the database will rebalance the data for you.

    • Rolling upgrades: Execute rolling updates according to CockroachDB Dedicated’s best practices to perform upgrades and apply security patches. And the database naturally handles online schema modifications as well, even for primary keys so you can avoid any downtime.

    • Resilience: Pods are ephemeral, but databases (nodes) are not; however, with CockroachDB, we use our core survivability capability combined with StatefulSets to elegantly recover from any pod failure.

    Basic distributed Backup and Restore are now in CockroachDB Core

    We want you to be able to build scalable production applications on our community option, CockroachDB Core. And with each release, we carefully review all of our capabilities to determine if any existing or new features should be placed into Core. We’ve outlined a set of guidelines to help us make these determinations and it seems we increasingly err on the side of Core these days.

    In our last major release (20.1), we added Role-Based Access Control (RBAC) to CockroachDB Core, giving community users more control over security. In this release, we’ve already spoken to the new Spatial capabilities that have been added to Core, and we’ve also added more advanced backup/restore capabilities to Core, including BACKUP, RESTORE, and EXPORT.

    We’ve been delighted to see CockroachDB Core clusters grow to support terabytes of data, and we recognize that scalable, distributed backups are crucial for these types of production applications. We hope these additions will let our community users achieve both effortless scale and peace of mind in production, with rock-solid disaster recovery plans:

    • BACKUP: Captures native binary data with very high reliability and reproducibility, writes to a number of different storage options such as AWS S3, Google Cloud Storage, NFS, or HTTP storage, and distributes work across the nodes to maximize performance.

    • RESTORE: Restores cluster databases or tables from a BACKUP.

    • EXPORT: Exports tabular data or the results of arbitrary SELECT statements to CSV files.

    More advanced Backup features, such as Incremental Backups, Encrypted Backups, Locality-Aware Backups, and Revision History remain only in CockroachDB Self-hosted and CockroachDB Dedicated.

    We’re incredibly grateful for the community feedback that challenges us to make our product better—for every discussion thread, Slack post, and email. Keep them coming!

    Automated, more seamless management

    To make CockroachDB as low-touch as possible, we’ve added more automated management capabilities and general improvements to operations.

    • Native scheduled Backups: Schedule backups directly from your CockroachDB cluster, instead of having to run a separate backup scheduler. As they are native to the database, scheduled backups have the same resilience as your cluster.

    • Userfile upload: Import data more easily with the new command cockroach userfile upload, which lets non-admins load files from their client into a cluster. User-scoped files protect from malicious actors and are a simple way to upload data from a laptop.

    • Faster imports: Bulk imports of data into CockroachDB are now significantly faster, so you can minimize time spent waiting for data to load. Imports are accomplished using the SQL command IMPORT, and let you import CSV/TSV files, Postgres dump files, MySQL dump files, and more.

    Stronger security and compliance in CockroachDB 20.2

    With 20.2, we’ve continued to improve CockroachDB’s security and compliance story to meet enterprise requirements and data privacy regulations.

    • Certificate Revocation: Revoke a TLS client certificate before its expiration date, helping improve security in the case a certificate is compromised. With this update, CockroachDB now supports Online Certificate Status Protocol (OCSP).

    • More granular Role Based Access Control (RBAC): 20.2 introduces a list of new privileges and role options for CockroachDB’s RBAC, meaning finer-grained permissions for database users.

    CockroachDB’s new storage engine: Pebble

    With the goal of continuous improvement of CockroachDB, our team built a new storage engine from scratch, called Pebble. Previously, CockroachDB used RocksDB, and while it has served us well, we saw an opportunity to further enhance CockroachDB with a purpose-built storage engine.Pebble is an open-source key value store written in Go, and it bring a number of improvements to CockroachDB:

    • Better performance and stability.

    • Avoids the challenges of traversing the Cgo boundary.

    • Gives us more control over future enhancements tailored for CockroachDB’s needs.

    Pebble is the default storage engine in CockroachDB 20.2, with the option to enable RocksDB if desired. Learn more about Pebble in this blog post.

    Innovate Faster with CockroachDB 20.2

    With the updates in CockroachDB 20.2, we continue to move towards a world where the database automatically handles all rote operations, scale, and resilience. It gives you a flexible platform you don’t have to worry about. It works, and it opens up a world of possibilities. And all that means you can focus your energy and output on developing, creating, and innovating. CockroachDB 20.2 is the database for modern cloud applications—let’s see what you can build!

    Try CockroachDB 20.2 for Free

    This blog post covers just a sampling of the updates in 20.2. For a full list, head over to the 20.2 Docs. To try out these features yourself, just download CockroachDB Core or spin up an instant, free cluster on CockroachDB Dedicated, our CockroachDB-as-a-Service offering.

    Finally, we love feedback and would love to hear from you. Please join our Slack community and connect with us today!

    Try 20.2 for free