Blog
System
How to use ADD CONSTRAINT in SQL (with examples)
One of the most compelling reasons to use a SQL database is that it can enforce rules about data for you, ensuring that it can only enter the database if it meets your specifications. But for it to do that effectively, you have to tell it what those rules are, so let’s talk about SQL constraints and how to add a constraint.
Charlie Custer
June 29, 2023
Product
What is a UUID, and what is it used for?
When working with a database, it’s common practice to use some kind of id field to provide a unique identifier for each row in a table. Imagine, for example, a customers table. We wouldn’t want to use fields such as name or address as unique identifiers because it’s possible more than one customer could have the same name, or share the same address, or in some cases even both! Instead, it’s a good idea to assign each row some kind of truly unique identifier. One option we have is to use a UUID.
Charlie Custer
June 29, 2023
Engineering
3 common foreign key mistakes (and how to avoid them)
Foreign keys are an important element of any relational database. But when you’re setting up your database schema, it’s relatively easy to create problems for yourself if the foreign keys aren’t set up correctly. Here are three of the most common mistakes made with foreign keys, and a little advice on how to avoid them!
Charlie Custer
June 28, 2023
Engineering
Performance Benefits of NOT NULL Constraints on Foreign Key Reference Columns
NOT NULL constraints are a ubiquitous tool for upholding data integrity. However, their performance benefits are less obvious. NOT NULL constraints provide a query optimizer with additional context that unlocks optimizations that significantly reduce query latency. In this post we’ll examine a few of these optimizations that transform query plans involving foreign key relationships.
Marcus Gartner
June 27, 2023
Design
Data Mesh: How Netflix moves and processes data from CockroachDB
At Netflix, data movement and data processing are essential functions that present significant challenges because of the vastness of their data architecture. There are so many different data sources to keep in sync and so many different consumers of the data that need accurate (and often) real-time access. Solving these challenges requires some clever engineering gymnastics that we’ll get to below. The content for this blog comes from a conversation between Netflix Senior Engineer, Vlad Sydorenko, and our own Director of Engineering, Jordan Lewis, in which they unpack how Netflix moves and processes data that comes from CockroachDB. (If you want to get to know Vlad a little bit you can check out this short interview.) The insights gleaned from their event-driven system help drive important business decisions that create better user experiences and substantial value for the company. Those insights are possible because of the data mesh that connects different sources, defines a pipeline, and makes the data accessible and useful.
Dan Kelly
June 22, 2023
System
How to export data with changefeeds
Exporting data is a crucial tool in any database user’s toolkit. In CockroachDB, the EXPORT command has long provided this essential functionality to: - Move data to a different data store for business analytics - Migrate data to a new database - Archive data in a platform-neutral way - Seed an application with data Say, for example, you need to export a sizable amount of JSON to seed a core data store for a streaming service. Sometimes you can pre-seed this data alongside your application with an EXPORT. But if you’re working on the scale of a company like Netflix, EXPORT commands come with some limitations that led us to explore an additional way to export data.
Abbey Russell
June 21, 2023
Product
How to troubleshoot and optimize query performance in CockroachDB
In an ideal world, all workloads are perfect and never face performance issues. In the real world, that’s hard to achieve. Your workload might not always follow best practices, or it could contain problematic queries that cause trouble.
Marylia Gutierrez
June 21, 2023
System
How to export data with changefeeds
Exporting data is a crucial tool in any database user’s toolkit. In CockroachDB, the EXPORT command has long provided this essential functionality to: Move data to a different data store for business analytics Migrate data to a new database Archive data in a platform-neutral way Seed an application with data Say, for example, you need to export a sizable amount of JSON to seed a core data store for a streaming service. Sometimes you can pre-seed this data alongside your application with an EXPORT. But if you’re working on the scale of a company like Netflix, EXPORT commands come with some limitations that led us to explore an additional way to export data.
Abbey Russell
June 21, 2023
Culture
How we celebrate Pride year-round at Cockroach Labs
CREWS (Cockroach Employees Who Support) are groups intended to create an inclusive environment for Roachers (Cockroach Labs employees) from underrepresented backgrounds and help employees connect with their peers on a deeper level. In this article, we’ll take a closer look at one such group: Roacher Pride
Charlie Custer
June 20, 2023