Skip to content

Commit 320eb15

Browse files
committed
Fix busted links
1 parent 05b222a commit 320eb15

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/current/v25.3/alter-table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ Suppose that you are storing the data for users of your application in a table c
18521852
);
18531853
~~~
18541854
1855-
The primary key of this table is on the `name` column. This is a poor choice, as some users likely have the same name, and all primary keys enforce a `UNIQUE` constraint on row values of the primary key column. Per our [best practices]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#use-functions-to-generate-unique-ids), you should instead use a [`UUID`]({% link {{ page.version.version }}/uuid.md %}) for single-column primary keys, and populate the rows of the table with generated, unique values.
1855+
The primary key of this table is on the `name` column. This is a poor choice, as some users likely have the same name, and all primary keys enforce a `UNIQUE` constraint on row values of the primary key column. Per our [best practices]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#use-functions-to-automatically-generate-unique-ids), you should instead use a [`UUID`]({% link {{ page.version.version }}/uuid.md %}) for single-column primary keys, and populate the rows of the table with generated, unique values.
18561856
18571857
You can add a column and change the primary key with a couple of `ALTER TABLE` statements:
18581858

src/current/v25.3/liquibase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ Suppose that you want to change the primary key of the `accounts` table from a s
351351
ALTER TABLE account ADD COLUMN unique_id UUID NOT NULL DEFAULT gen_random_uuid();
352352
~~~
353353
354-
This statement adds [a new `unique_id` column]({% link {{ page.version.version }}/alter-table.md %}#add-column) to the `accounts` table, with the default value as [a randomly-generated UUID]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#use-functions-to-generate-unique-ids).
354+
This statement adds [a new `unique_id` column]({% link {{ page.version.version }}/alter-table.md %}#add-column) to the `accounts` table, with the default value as [a randomly-generated UUID]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#use-functions-to-automatically-generate-unique-ids).
355355
356356
1. In the `changelog-main.xml` file, add the following after the second `changeSet` element:
357357

src/current/v25.3/performance-best-practices-overview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ The best practices for generating unique IDs in a distributed database like Cock
6868

6969
To create unique and non-sequential IDs, we recommend the following approaches (listed in order from best to worst performance):
7070

71-
| Approach | Pros | Cons |
72-
|--------------------------------------------------------------------------------------+--------------------------------------------------+-----------------------------------------------------------------------------------------|
73-
| 1. [Use multi-column primary keys](#use-multi-column-primary-keys) | Potentially fastest, if done right | Complex, requires up-front design and testing to ensure performance |
74-
| 2. [Use functions to generate unique IDs](#use-functions-to-generate-unique-ids) | Good performance; spreads load well; easy choice | May leave some performance on the table; requires other columns to be useful in queries |
75-
| 3. [Use `INSERT` with the `RETURNING` clause](#use-insert-with-the-returning-clause-to-generate-unique-ids) | Easy to query against; familiar design | Slower performance than the other options; higher chance of [transaction contention](#transaction-contention) |
71+
| Approach | Pros | Cons |
72+
|-------------------------------------------------------------------------------------------------------------+--------------------------------------------------+---------------------------------------------------------------------------------------------------------------|
73+
| 1. [Use multi-column primary keys](#use-multi-column-primary-keys) | Potentially fastest, if done right | Complex, requires up-front design and testing to ensure performance |
74+
| 2. [Use functions to generate unique IDs](#use-functions-to-automatically-generate-unique-ids) | Good performance; spreads load well; easy choice | May leave some performance on the table; requires other columns to be useful in queries |
75+
| 3. [Use `INSERT` with the `RETURNING` clause](#use-insert-with-the-returning-clause-to-generate-unique-ids) | Easy to query against; familiar design | Slower performance than the other options; higher chance of [transaction contention](#transaction-contention) |
7676

7777
Traditional approaches using monotonically increasing [`INT`]({% link {{ page.version.version }}/int.md %}) or [`SERIAL`]({% link {{ page.version.version }}/serial.md %}) data types will create [hotspots](#hotspots) for both reads and writes in a distributed database like CockroachDB. {% include {{page.version.version}}/performance/use-hash-sharded-indexes.md %}
7878

0 commit comments

Comments
 (0)