We have been using CockroachDB for the last two years. From 2023, we started working on a product similar to Google Capture. We decided to work with CockroachDB with Hasura. Hasura is a UI for the database CockroachDB that provides a playground to work with the API and data. Since CockroachDB primarily supports SQL, we didn't want to use plain SQL in our programming, so we decided to go with ORM and selected Hasura. With Hasura, we sometimes require GraphQL. Besides using GraphQL, we have also used SQL with CockroachDB directly to get data and perform insert and update operations.
Regarding our operations, CockroachDB equals PostgreSQL plus Google Spanner, and we can remove scalability, then add resilience across regions.
For CockroachDB multi-active availability, all replicas of our data are active and can serve read and write simultaneously. Currently, we are not using these features because our database is not too large with only 20 customers using our application. MAA is a feature provided by CockroachDB, but they charge for this functionality. It has consequences by raft where each range of data is replicated with default three replicas. Writes go through raft consensus where a majority of replicas must agree, ensuring strong consistency even if some nodes or regions fail.
Regarding multi-region or global clusters, it allows spanning clusters across multiple regions. We are configured with AWS because we use Lambda functions on the server end. The zone configuration lets you control where replicas live, such as keeping EU customer data in EU and US customer data in US, though we aren't currently using this feature.
ACID transactions are not required in our application because we don't have any payment gateway currently. CockroachDB uses a two-phase commit protocol on top of raft consensus. If any part of the transaction fails, commits, times out, or node crashes, CockroachDB automatically rolls back.
The benefits include being developer-friendly, strong security with RBAC, encryption, and data residency laws by pinning data to specific regions. It is self-healing because if a node crashes, data automatically rebalances to healthy nodes without manual failover, replication, or clustering needed. Finally, it offers cost efficiency.
CockroachDB is excellent for managing relationships in RDBMS. There are multiple benefits such as the ability to create views and dynamic queries that save data and reduce the use of complex algorithms in code. Instead of writing algorithms to get desired output, we can directly call the views where predefined algorithms form the view to get the desired output.
CockroachDB's geo-distribution feature is superior to traditional databases. The admin UI can be used according to requirements. Compared to traditional databases PostgreSQL and MySQL, CockroachDB provides both SQL features and is horizontally scalable, meaning it is cloud-native. We can start with a single node and scale to hundreds of nodes across multiple regions. It automatically distributes data and workload without manual sharding.
The database offers high availability and fault tolerance with data replicated across nodes and regions. It is compatible with various drivers and ORMs including Prisma, Sequelize, and Hibernate. It provides automatic migrations and online schema changes. Security features include encryption in transit, role-based access control, and compliance with data residency laws by pinning data to specific regions.
CockroachDB supports ACID transactions and is cloud-native, allowing creation of hundreds of microservices with multiple regions. The automatic data and workload distribution eliminates the need for sharding, which is required in databases MongoDB.
The platform should provide a UI feature where users have the ability to manage it. The CockroachDB platform should have a chatbot where users can inquire about pricing or seek solutions for queries, rather than relying on email support.
The current UI only provides SQL playground, which is technical. There should be a UI playground where users with limited technical knowledge can run and update queries, similar to phpMyAdmin or Adminer.
Latency optimization could be improved for globally distributed applications, particularly in query routing. For multi-region deployment, CockroachDB requires at least three plus replicas across data centers to achieve strong consistency across regions, which increases infrastructure costs including compute, storage, and networking.
The disadvantages include cost-efficiency with multi-region deployment and schema migration speed, which should be faster compared to other drivers. The query optimizer should handle complex queries better through the UI interface.
We have been using CockroachDB for the last two years.
I contacted technical support once regarding an error modifying field data types. I received a response within two to three hours, and the issue was resolved efficiently.
The setup was very straightforward. Everything was mentioned in the documentation, and even a layman or business analyst can complete the setup without having technical knowledge.
The tech support deserves a rating of nine out of ten. My overall rating for CockroachDB is 8 out of 10.