CockroachDB
Author: s | 2025-04-24
CockroachDB Cloud Overview. CockroachDB Cloud is a fully-managed service run by Cockroach Labs, which simplifies the deployment and management of CockroachDB. This page provides an introduction to CockroachDB Cloud and provides an overview of each type of cluster: CockroachDB Standard, CockroachDB Basic, and CockroachDB Advanced.
Contributing to CockroachDB - CockroachDB - Confluence
Skip to content Navigation Menu GitHub Copilot Write better code with AI Security Find and fix vulnerabilities Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes Discussions Collaborate outside of code Code Search Find more, search less Explore Learning Pathways Events & Webinars Ebooks & Whitepapers Customer Stories Partners Executive Insights GitHub Sponsors Fund open source developers The ReadME Project GitHub community articles Enterprise platform AI-powered developer platform Pricing Provide feedback Saved searches Use saved searches to filter your results more quickly ;ref_cta:Sign up;ref_loc:header logged out"}"> Sign up the scalable, survivable, SQL database Verified We've verified that the organization cockroachdb controls the domain: www.cockroachlabs.com Overview Repositories Projects Packages People Sponsoring Pinned Loading CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement. Go 30.6k 3.9k CockroachDB user documentation HTML 195 468 RocksDB/LevelDB inspired key-value database in Go Go 5.2k 489 Go error library with error portability over the network Go 2.2k 66 Repositories --> Type Select type All Public Sources Forks Archived Mirrors Templates Language Select language All Astro C C# C++ Clojure Dockerfile Go HTML Java JavaScript Mustache Protocol Buffer Python Ruby Rust Scala Shell Smarty Starlark TSQL TypeScript Vim Script Sort Select order Last updated Name Stars Showing 10 of 209 repositories cockroach Public CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement. cockroachdb/cockroach’s past year of commit activity pebble Public RocksDB/LevelDB inspired key-value database in Go cockroachdb/pebble’s past year of commit activity cockroachdb/cockroach-go’s past year of commit activity cockroachdb/cockroach-operator’s past year of commit activity docs Public CockroachDB user documentation cockroachdb/docs’s past year of commit activity demo-video-code Public A collection of code examples to accompany demo videos. cockroachdb/demo-video-code’s past year of commit activity Go 1 0 0 0 Updated Mar 21, 2025 cockroachdb/helm-charts’s past year of commit activity Go 89 Apache-2.0 150 45 31 Updated Mar 21, 2025 cockroachdb/activerecord-cockroachdb-adapter’s past year of commit activity Ruby 106 Apache-2.0 51 21 7 Updated Mar 20, 2025 stress Public A fork of Golang's stress function. cockroachdb/stress’s past year of commit activity Go 5 BSD-3-Clause 6 0 1 Updated Mar 20, 2025 errors Public Go error library with error portability over the network cockroachdb/errors’s past year of commit activity Most used topics
GitHub - cockroachdb/cockroach: CockroachDB the cloud
Complicated to set up and even harder to maintain. One of the Principal Engineers on the project suggested taking a look at CockroachDB, a cloud-native distributed database that met their requirements:High availability (99.999%)Guaranteed data consistency Ability to scale across multiple regions and multiple clouds Easy, horizontal scale (no manual sharding required)Stash started building on CockroachDB core (the free, open-source version) and found the transition from PostgreSQL to be seamless. Once they were ready to implement their initial design, they requested an enterprise license so they could access certain CockroachDB features, such as backups and the capability to extend across multiple regions. “There’s a lot of databases out there on the market. However, on paper, CockroachDB met all of our requirements to build a highly available platform. We felt like we were making an informed decision about our tech stack, and CockroachDB truly lived up to the expectations that it promised.”-Michael Swendener,Senior DevOps EngineerSource of TruthThough the Stash Core project took years to implement in full, Stash’s GTM timeline for this aspect of the new banking infrastructure was a compact six months. After the development phase, the team reports that they had “no issues getting into production with CockroachDB.” After a successful soft launch in September 2022, they opened the platform up to all customers in December 2022. CockroachDB serves as a system of record (or source of truth) for the entire banking infrastructure. It processes and stores all types of mission-critical workloads, including banking data, customer data, PII, accounting info, and more. Right now, Stash is self-hosting CockroachDB in a single AWS region and plans to expand out to four regions in the near future. They’re running a multi-region cluster now to test its functionality before moving into production. As mentioned above, running your application across multiple regions and multiple clouds is a great approach when designing fault-tolerant systems and reducing risk for your business.Stash also uses Kubernetes alongside CockroachDB. Since CockroachDB and K8s have the same distributed principles, they work well together and make it easier for engineers to build distributed applications.”CockroachDB is our source of truth… It stores everything for our banking partner. When building a mission-critical application, we wanted to choose the right technologies that would guarantee our customer’s data would never be at risk. CockroachDB lived up to its expectations that it promised.”-Jordan Larrigan,Engineering ManagerSupport systemWhile Stash’s engineering team already had PostgreSQL experience and felt comfortableCockroachDB (@cockroachdb) Instagram photos and videos
CLI tool.Note:The ccloud CLI tool is in Preview.Install ccloudChoose your OS:You can install ccloud using either Homebrew or by downloading the binary.Use HomebrewInstall Homebrew.Install using the ccloud tap:icon/buttons/copybrew install cockroachdb/tap/ccloudDownload the binaryIn a terminal, enter the following command to download and extract the ccloud binary and add it to your PATH: icon/buttons/copy curl | tar -xJ && cp -i ccloud /usr/local/bin/Use the ARM 64 binary if you have an M-series Mac: icon/buttons/copy curl | tar -xJ && cp -i ccloud /usr/local/bin/In a terminal, enter the following command to download and extract the ccloud binary and add it to your PATH: icon/buttons/copy curl | tar -xz && cp -i ccloud /usr/local/bin/In a PowerShell window, enter the following command to download and extract the ccloud binary and add it to your PATH: icon/buttons/copy $ErrorActionPreference = "Stop"; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $ProgressPreference = 'SilentlyContinue'; $null = New-Item -Type Directory -Force $env:appdata/ccloud; Invoke-WebRequest -Uri -OutFile ccloud.zip; Expand-Archive -Force -Path ccloud.zip; Copy-Item -Force ccloud/ccloud.exe -Destination $env:appdata/ccloud; $Env:PATH += ";$env:appdata/ccloud"; # We recommend adding ";$env:appdata/ccloud" to the Path variable for your system environment. See for more information.Run ccloud quickstart to create a new cluster, create a SQL user, and retrieve the connection string.The easiest way of getting started with CockroachDB Cloud is to use ccloud quickstart. The ccloud quickstart command guides you through logging in to CockroachDB Cloud, creating a new CockroachDB Serverless cluster, and connecting to the new cluster. Run ccloud quickstart and follow the instructions: icon/buttons/copy The ccloud quickstart command will open a browser window to log you in to CockroachDB Cloud. If you are new to CockroachDB Cloud, you can register using one of the single sign-on (SSO) options, or create a new account using an email address.The ccloud quickstart command will prompt you for the cluster name, cloud provider, and cloud provider region,. CockroachDB Cloud Overview. CockroachDB Cloud is a fully-managed service run by Cockroach Labs, which simplifies the deployment and management of CockroachDB. This page provides an introduction to CockroachDB Cloud and provides an overview of each type of cluster: CockroachDB Standard, CockroachDB Basic, and CockroachDB Advanced. CockroachDB Cloud Overview. CockroachDB Cloud is a fully-managed service run by Cockroach Labs, which simplifies the deployment and management of CockroachDB. This page provides an introduction to CockroachDB Cloud and provides an overview of each type of cluster: CockroachDB Standard, CockroachDB Basic, and CockroachDB Advanced.CockroachDB - How to Install CockroachDB for Windows - YouTube
Using CockroachDB spatial features with Active Record, see the activerecord-cockroachdb-adapter README.GeoDjangoStarting with CockroachDB 20.2.x and django-cockroachdb 3.1.3, CockroachDB is compatible with GeoDjango. For information about using CockroachDB spatial features with GeoDjango, see the django-cockroachdb README.Note:Most PostGIS-compatible client libraries are incompatible with CockroachDB's spatial features without an adapter.TroubleshootingFor general CockroachDB troubleshooting information, see Troubleshooting Overview.If you need help troubleshooting an issue with our spatial support, please get in touch using our Support resources.PerformanceIn order to avoid full table scans, make sure to add indexes to any columns that are accessed as part of a predicate in the WHERE clause. For geospatial columns, the index will only be used if the column is accessed using an index-accelerated geospatial function from the list below (all of these functions work on GEOMETRY data types; a * means that a function also works on GEOGRAPHY data types):ST_Covers (*)ST_CoveredBy (*)ST_ContainsST_ContainsProperlyST_CrossesST_DWithin (*)ST_DFullyWithinST_EqualsST_Intersects (*)ST_OverlapsST_TouchesST_WithinTo use a version of a function from the list above that will explicitly not use the index, add an underscore (_) to the beginning of the function name, e.g., _ST_Covers.You can check which queries are using which indexes using the EXPLAIN statement. For more information about general query tuning (including index usage), see Optimize Statement Performance.The syntax for adding an index to a geometry column is CREATE INDEX index_name ON table_name USING GIST (column_name).For example, to add an index to the geom column of the sample tornadoes table: icon/buttons/copy CREATE INDEX tornado_geom_idx ON tornadoes USING GIST (geom);This creates a (spatial) GIN index on the geom column.Because CockroachDB is a scale-out, multi-node database, our spatial indexing strategy is based on a space-filling curve/quad-tree design (also known as "divide the space"), rather than the R-Tree data structure used by some other spatial databases (also known as "divide the objects"). Other databases that use a "divide theGitHub - cockroachdb/libedit: CockroachDB fork of the libedit
Version v25.1.1 On this page This tutorial shows you how run a simple application built with TypeORM.Step 1. Start CockroachDBChoose your installation methodYou can install a CockroachDB Serverless cluster using either the CockroachDB Cloud Console, a web-based graphical user interface (GUI) tool, or ccloud, a command-line interface (CLI) tool.Create a free clusterNote:Organizations without billing information on file can only create one CockroachDB Basic cluster.If you haven't already, sign up for a CockroachDB Cloud account.Log in to your CockroachDB Cloud account.On the Clusters page, click Create cluster.On the Select a plan page, select Basic.On the Cloud & Regions page, select a cloud provider (GCP or AWS) in the Cloud provider section. In the Regions section, select a region for the cluster. Refer to CockroachDB Cloud Regions for the regions where CockroachDB Basic clusters can be deployed. To create a multi-region cluster, click Add region and select additional regions.Click Next: Capacity.On the Capacity page, select Start for free. Click Next: Finalize.On the Finalize page, click Create cluster.Your cluster will be created in a few seconds and the Create SQL user dialog will display.Create a SQL userThe Create SQL user dialog allows you to create a new SQL user and password.Enter a username in the SQL user field or use the one provided by default.Click Generate & save password.Copy the generated password and save it in a secure location.Click Next.Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see Manage SQL users on a cluster.Get the connection informationThe Connect to cluster dialog shows information about how to connect to your cluster.Select Parameters only from the Select option dropdown.Copy the connection information for each parameter displayed and save it in a secure location.Follow these steps to create a CockroachDB Serverless cluster using the ccloudcockroachdb/docs: CockroachDB user documentation - GitHub
Space" strategy include Microsoft SQL Server and MongoDB.For more detailed information about how CockroachDB's spatial indexes work, see Spatial indexes.If you encounter behavior that you think is due to a performance issue, please get in touch using our Support resources.ExamplesLoad NYC data for the PostGIS tutorialFollow the steps below to load the SQL for the NYC data used in the Introduction to PostGIS tutorial.Note:CockroachDB can work with the tutorial up to Chapter 22, with the following exceptions:Do not try to load Shapefiles via the GUI as shown in the tutorial. Instead, follow the steps below to load the SQL data directly into CockroachDB. (We have already converted the tutorial Shapefiles to SQL for you.)CockroachDB does not support GML or KML data.CockroachDB does not support SVG.Before you beginInstall a build of CockroachDB with support for spatial data by following the instructions at Install CockroachDB.Start a local insecure cluster and connect to that cluster from a SQL client:icon/buttons/copycockroach sql --insecure --host=localhost --port=26257Leave this shell open for use in the examples below.Step 1. Load the NYC dataClone the data set: icon/buttons/copy git clone the SQL files into your CockroachDB cluster: icon/buttons/copy cat otan-scripts/geospatial_sql/*.sql | cockroach sql --insecure --host=localhost --port=26257The command above will take a few minutes to run.Step 2. Follow the PostGIS tutorialWhen the cluster is finished loading the data, open a SQL shell and start working through the Introduction to PostGIS tutorial: icon/buttons/copy cockroach sql --insecure --host=localhost --port=26257Use a sample Shapefile datasetThis page has instructions for querying spatial data imported into CockroachDB. On this page, we use a sample Shapefile dataset from the National Oceanic and Atmospheric Administration.Before you beginInstall a build of CockroachDB with support for spatial data by following the instructions at Install CockroachDB.Start a local insecure cluster and connect to that cluster from a SQL client:icon/buttons/copycockroach sql --insecure --host=localhostGetting and building CockroachDB from source - CockroachDB
Upgrade Nakama#When upgrading to a new version of Nakama, you need to do three things before you run the newer version:Check the Release Notes, in case that version has specific upgrade requirements.Migrate your data to the format supported by the new version of Nakama.Ensure that the client version you’re running is compatible with the server deployed.Docker#As new versions of Nakama, or CockroachDB, become available you might want to upgrade. Docker makes upgrading easy, as all you need to do is pull down a new version of the container image. When upgrading to a new version of Nakama, the process in the docker-compose.yml performs a migration of your data to the new database schema automatically.You can pull the most recent Nakama image and allow Docker Compose to perform the data migration.123docker-compose down # top and remove both the Nakama and CockroachDB containersdocker pull heroiclabs/nakama # download the latest Nakama imagedocker-compose up # start the containers (both Nakama and CockroachDB) as fresh installsAnd, similarly, here’s how to update the CockroachDB container:1docker pull cockroachdb/cockroach # download the latest CockroachDB imageIf you’d like to explicitly run a database schema migration, issue the following command:1docker run heroiclabs/nakama migrate upManual upgrade#You can upgrade one node or your whole cluster to the latest version of Nakama by following the instructions below.For each node in the cluster:Stop Nakama. If you are using systemd on a Linux setup, the command is:1sudo systemctl stop nakamaBack-up CockroachDB:1cockroach dump nakama > mydatabackup.sql --insecureDownload the latest release and replace the nakama binary with. CockroachDB Cloud Overview. CockroachDB Cloud is a fully-managed service run by Cockroach Labs, which simplifies the deployment and management of CockroachDB. This page provides an introduction to CockroachDB Cloud and provides an overview of each type of cluster: CockroachDB Standard, CockroachDB Basic, and CockroachDB Advanced.
CockroachDB - pages.cs.wisc.edu
Competition is good. It focuses your energies. It keeps you sharp and pushes you to be better. At Cockroach Labs we welcome competition. It hasn't escaped our notice that a new entrant in the database landscape is frequently comparing themselves against us, making claims about their performance and functionality vis-a-vis our own. We decided to take a closer look. This is our analysis of CockroachDB vs. Yugabyte v2.0.0. All benchmark comparisons were done with CockroachDB v19.2.0.TLDR: CockroachDB vs Yugabyte On Yugabyte's custom benchmark we discovered an apples to oranges performance comparison due to the behavior of the benchmark and Yugabyte's choice to use hash partitioning by default. We unpack why using hash partitioning by default is a dubious choice for a SQL database. After adjusting for these discoveries, CockroachDB outperforms Yugabyte on all of the workloads. On Sysbench we discovered problems in Yugabyte with schema changes and batching. The schema change problems are architectural and will be challenging to solve. The performance problems with batching look to be solvable with a bit of elbow grease. On Sysbench we discovered that Yugabyte returns transaction retry errors in situations that neither PostgreSQL or CockroachDB do. These transaction retry errors cause Sysbench to fail to complete on several workloads. We were only able to gather results for Yugabyte on 4 of the 9 Sysbench workloads. CockroachDB can successfully complete all 9 workloads. On YCSB we compared Yugabyte's SQL performance to CockroachDB and showed CockroachDB performance is better across all workloads. We discovered that Yugabyte SQL tables have a maximum of 50 tablets. We discovered that Yugabyte tablets do not split or merge which requires the operator to make an important upfront decision on their data schema. We discovered that a Yugabyte range partitioned table is limited to a single tablet which limits the performance and scalability of such tables. We discovered differences between CockroachDB's distributed SQL execution which decomposes SQL queries in order to run them close to data, and Yugabyte's SQL execution which moves data to a gateway node for centralized processing. We discovered that without application-level coordination Yugabyte schema changes can easily lead to data inconsistencies.cockroachdb/helm-charts: Helm charts for cockroachdb - GitHub
Then ask if you want to connect to the cluster. Each prompt has default values that you can select, or change if you want a different option.Select Parameters only then copy the connection parameters displayed and save them in a secure location.? How would you like to connect? Parameters onlyLooking up cluster ID: succeededCreating SQL user: succeededSuccess! Created SQL user name: maxroach cluster: 37174250-b944-461f-b1c1-3a99edb6af32Retrieving cluster info: succeededConnection parameters Database: defaultdb Host: blue-dog-147.6wr.cockroachlabs.cloud Password: ThisIsNotAGoodPassword Port: 26257 Username: maxroachIf you haven't already, download the CockroachDB binary.Run the cockroach start-single-node command:icon/buttons/copy$ cockroach start-single-node --advertise-addr 'localhost' --insecureThis starts an insecure, single-node cluster.Take note of the following connection information in the SQL shell welcome text:CockroachDB node starting at 2021-08-30 17:25:30.06524 +0000 UTC (took 4.3s)build: CCL v21.1.6 @ 2021/07/20 15:33:43 (go1.15.11)webui: postgresql://root@localhost:26257?sslmode=disableYou'll use the sql connection string to connect to the cluster later in this tutorial.Warning:The --insecure flag used in this tutorial is intended for non-production testing only. To run CockroachDB in production, use a secure cluster instead.Step 2. Get the codeClone the code's GitHub repository:icon/buttons/copy$ git clone [email protected]:cockroachlabs/example-app-typescript-typeorm.gitNavigate to the repo directory and install the application dependencies:icon/buttons/copy$ cd example-app-typescript-typeormicon/buttons/copyStep 3. Configure your CockroachDB connectionOpen the datasource.ts file, and comment out the ssl: true, extra and options configuration properties.In the datasource.ts file, uncomment ssl: { rejectUnauthorized: false }.Warning:Only use ssl: { rejectUnauthorized: false } in development, for insecure connections.The DataSource configuration should look similar to the following:export const AppDataSource = new DataSource({ type: "cockroachdb", url: process.env.DATABASE_URL, ssl: { rejectUnauthorized: false }, // For insecure connections only synchronize: true, logging: false, entities: ["src/entity/**/*.ts"], migrations: ["src/migration/**/*.ts"], subscribers: ["src/subscriber/**/*.ts"],})Set the DATABASE_URL environment variable to the connection string provided in the cockroach welcome text:icon/buttons/copyexport DATABASE_URL="postgresql://root@localhost:26257/defaultdb?sslmode=disable"Set the DATABASE_URL environment variable to a CockroachDB connection string compatible with TypeORM.icon/buttons/copyexport DATABASE_URL=""TypeORM accepts the following format for CockroachDB Standard connection strings:icon/buttons/copypostgresql://:@:/Step 4. Run. CockroachDB Cloud Overview. CockroachDB Cloud is a fully-managed service run by Cockroach Labs, which simplifies the deployment and management of CockroachDB. This page provides an introduction to CockroachDB Cloud and provides an overview of each type of cluster: CockroachDB Standard, CockroachDB Basic, and CockroachDB Advanced.abhipsnl/cockroachdb-on-aws: Deploy cockroachdb on AWS, IaC
On this page This page provides information about working with spatial data in CockroachDB.Supported data typesSupported spatial data types include:Geometric objects such as points, lines, and polygons in 2-dimensional space. These are projected onto the flat surface of a plane and are represented in SQL by the GEOMETRY data type.Geographic objects, which are also made up of points, lines, polygons, etc., in 2-dimensional space. They are projected onto the surface of a sphere and are represented in SQL by the GEOGRAPHY data type. (Technically, they are projected onto a spheroid: "a sphere with a bulge"). The spheroid projection means that:The X and Y coordinates of 2-dimensional points are longitude and latitude values.The paths between geographic objects are not straight lines; they are curves, and so the distances between objects are calculated using great circle math.CompatibilityJust as CockroachDB strives for PostgreSQL compatibility, our spatial data support is designed to be as compatible as possible with the functionality provided by the PostGIS extension. CockroachDB is compatible with PostGIS Version 3.0 and up.CockroachDB does not implement the full list of PostGIS built-in functions and operators. Also, spatial indexing works differently (see the Performance section below). For a list of the spatial functions CockroachDB supports, see Geospatial functions.If your application needs support for functions that are not yet implemented, check the meta-issue for built-in function support on GitHub, which describes how to find an issue for the built-in function(s) you need.For a list of other known limitations, see Known Limitations.ORM compatibilityThe following ORM spatial libraries are fully compatible with CockroachDB's spatial features:Hibernate SpatialHibernate 5.4.30.Final added the CockroachDB202SpatialDialect dialect to the hibernate-spatial module. The CockroachDB202SpatialDialect dialect supports spatial features available in CockroachDB v20.2 and later.RGeo/RGeo::ActiveRecordCockroachDB's Active Record adapter (activerecord-cockroachdb-adapter) uses RGeo and RGeo::ActiveRecord for spatial support with Active Record v6.0.0+ and v7.0.0+. For information aboutComments
Skip to content Navigation Menu GitHub Copilot Write better code with AI Security Find and fix vulnerabilities Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes Discussions Collaborate outside of code Code Search Find more, search less Explore Learning Pathways Events & Webinars Ebooks & Whitepapers Customer Stories Partners Executive Insights GitHub Sponsors Fund open source developers The ReadME Project GitHub community articles Enterprise platform AI-powered developer platform Pricing Provide feedback Saved searches Use saved searches to filter your results more quickly ;ref_cta:Sign up;ref_loc:header logged out"}"> Sign up the scalable, survivable, SQL database Verified We've verified that the organization cockroachdb controls the domain: www.cockroachlabs.com Overview Repositories Projects Packages People Sponsoring Pinned Loading CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement. Go 30.6k 3.9k CockroachDB user documentation HTML 195 468 RocksDB/LevelDB inspired key-value database in Go Go 5.2k 489 Go error library with error portability over the network Go 2.2k 66 Repositories --> Type Select type All Public Sources Forks Archived Mirrors Templates Language Select language All Astro C C# C++ Clojure Dockerfile Go HTML Java JavaScript Mustache Protocol Buffer Python Ruby Rust Scala Shell Smarty Starlark TSQL TypeScript Vim Script Sort Select order Last updated Name Stars Showing 10 of 209 repositories cockroach Public CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement. cockroachdb/cockroach’s past year of commit activity pebble Public RocksDB/LevelDB inspired key-value database in Go cockroachdb/pebble’s past year of commit activity cockroachdb/cockroach-go’s past year of commit activity cockroachdb/cockroach-operator’s past year of commit activity docs Public CockroachDB user documentation cockroachdb/docs’s past year of commit activity demo-video-code Public A collection of code examples to accompany demo videos. cockroachdb/demo-video-code’s past year of commit activity Go 1 0 0 0 Updated Mar 21, 2025 cockroachdb/helm-charts’s past year of commit activity Go 89 Apache-2.0 150 45 31 Updated Mar 21, 2025 cockroachdb/activerecord-cockroachdb-adapter’s past year of commit activity Ruby 106 Apache-2.0 51 21 7 Updated Mar 20, 2025 stress Public A fork of Golang's stress function. cockroachdb/stress’s past year of commit activity Go 5 BSD-3-Clause 6 0 1 Updated Mar 20, 2025 errors Public Go error library with error portability over the network cockroachdb/errors’s past year of commit activity Most used topics
2025-04-22Complicated to set up and even harder to maintain. One of the Principal Engineers on the project suggested taking a look at CockroachDB, a cloud-native distributed database that met their requirements:High availability (99.999%)Guaranteed data consistency Ability to scale across multiple regions and multiple clouds Easy, horizontal scale (no manual sharding required)Stash started building on CockroachDB core (the free, open-source version) and found the transition from PostgreSQL to be seamless. Once they were ready to implement their initial design, they requested an enterprise license so they could access certain CockroachDB features, such as backups and the capability to extend across multiple regions. “There’s a lot of databases out there on the market. However, on paper, CockroachDB met all of our requirements to build a highly available platform. We felt like we were making an informed decision about our tech stack, and CockroachDB truly lived up to the expectations that it promised.”-Michael Swendener,Senior DevOps EngineerSource of TruthThough the Stash Core project took years to implement in full, Stash’s GTM timeline for this aspect of the new banking infrastructure was a compact six months. After the development phase, the team reports that they had “no issues getting into production with CockroachDB.” After a successful soft launch in September 2022, they opened the platform up to all customers in December 2022. CockroachDB serves as a system of record (or source of truth) for the entire banking infrastructure. It processes and stores all types of mission-critical workloads, including banking data, customer data, PII, accounting info, and more. Right now, Stash is self-hosting CockroachDB in a single AWS region and plans to expand out to four regions in the near future. They’re running a multi-region cluster now to test its functionality before moving into production. As mentioned above, running your application across multiple regions and multiple clouds is a great approach when designing fault-tolerant systems and reducing risk for your business.Stash also uses Kubernetes alongside CockroachDB. Since CockroachDB and K8s have the same distributed principles, they work well together and make it easier for engineers to build distributed applications.”CockroachDB is our source of truth… It stores everything for our banking partner. When building a mission-critical application, we wanted to choose the right technologies that would guarantee our customer’s data would never be at risk. CockroachDB lived up to its expectations that it promised.”-Jordan Larrigan,Engineering ManagerSupport systemWhile Stash’s engineering team already had PostgreSQL experience and felt comfortable
2025-04-24Using CockroachDB spatial features with Active Record, see the activerecord-cockroachdb-adapter README.GeoDjangoStarting with CockroachDB 20.2.x and django-cockroachdb 3.1.3, CockroachDB is compatible with GeoDjango. For information about using CockroachDB spatial features with GeoDjango, see the django-cockroachdb README.Note:Most PostGIS-compatible client libraries are incompatible with CockroachDB's spatial features without an adapter.TroubleshootingFor general CockroachDB troubleshooting information, see Troubleshooting Overview.If you need help troubleshooting an issue with our spatial support, please get in touch using our Support resources.PerformanceIn order to avoid full table scans, make sure to add indexes to any columns that are accessed as part of a predicate in the WHERE clause. For geospatial columns, the index will only be used if the column is accessed using an index-accelerated geospatial function from the list below (all of these functions work on GEOMETRY data types; a * means that a function also works on GEOGRAPHY data types):ST_Covers (*)ST_CoveredBy (*)ST_ContainsST_ContainsProperlyST_CrossesST_DWithin (*)ST_DFullyWithinST_EqualsST_Intersects (*)ST_OverlapsST_TouchesST_WithinTo use a version of a function from the list above that will explicitly not use the index, add an underscore (_) to the beginning of the function name, e.g., _ST_Covers.You can check which queries are using which indexes using the EXPLAIN statement. For more information about general query tuning (including index usage), see Optimize Statement Performance.The syntax for adding an index to a geometry column is CREATE INDEX index_name ON table_name USING GIST (column_name).For example, to add an index to the geom column of the sample tornadoes table: icon/buttons/copy CREATE INDEX tornado_geom_idx ON tornadoes USING GIST (geom);This creates a (spatial) GIN index on the geom column.Because CockroachDB is a scale-out, multi-node database, our spatial indexing strategy is based on a space-filling curve/quad-tree design (also known as "divide the space"), rather than the R-Tree data structure used by some other spatial databases (also known as "divide the objects"). Other databases that use a "divide the
2025-04-06Version v25.1.1 On this page This tutorial shows you how run a simple application built with TypeORM.Step 1. Start CockroachDBChoose your installation methodYou can install a CockroachDB Serverless cluster using either the CockroachDB Cloud Console, a web-based graphical user interface (GUI) tool, or ccloud, a command-line interface (CLI) tool.Create a free clusterNote:Organizations without billing information on file can only create one CockroachDB Basic cluster.If you haven't already, sign up for a CockroachDB Cloud account.Log in to your CockroachDB Cloud account.On the Clusters page, click Create cluster.On the Select a plan page, select Basic.On the Cloud & Regions page, select a cloud provider (GCP or AWS) in the Cloud provider section. In the Regions section, select a region for the cluster. Refer to CockroachDB Cloud Regions for the regions where CockroachDB Basic clusters can be deployed. To create a multi-region cluster, click Add region and select additional regions.Click Next: Capacity.On the Capacity page, select Start for free. Click Next: Finalize.On the Finalize page, click Create cluster.Your cluster will be created in a few seconds and the Create SQL user dialog will display.Create a SQL userThe Create SQL user dialog allows you to create a new SQL user and password.Enter a username in the SQL user field or use the one provided by default.Click Generate & save password.Copy the generated password and save it in a secure location.Click Next.Currently, all new SQL users are created with admin privileges. For more information and to change the default settings, see Manage SQL users on a cluster.Get the connection informationThe Connect to cluster dialog shows information about how to connect to your cluster.Select Parameters only from the Select option dropdown.Copy the connection information for each parameter displayed and save it in a secure location.Follow these steps to create a CockroachDB Serverless cluster using the ccloud
2025-04-22