Skip to content

Commit 3eb508e

Browse files
author
Lauren
committed
Style Guide fixit day
1 parent de8b26b commit 3eb508e

40 files changed

+452
-245
lines changed

v2.1/add-column.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
2323
| `table_name` | The name of the table to which you want to add the column. |
2424
| `column_name` | The name of the column you want to add. The column name must follow these [identifier rules](keywords-and-identifiers.html#identifiers) and must be unique within the table but can have the same name as indexes or constraints. |
2525
| `typename` | The [data type](data-types.html) of the new column. |
26-
| `col_qualification` | An optional list of column definitions, which may include [column-level constraints](constraints.html), [collation](collate.html), or [column family assignments](column-families.html).<br><br>Note that it is not possible to add a column with the [Foreign Key](foreign-key.html) constraint. As a workaround, you can add the column without the constraint, then use [`CREATE INDEX`](create-index.html) to index the column, and then use [`ADD CONSTRAINT`](add-constraint.html) to add the Foreign Key constraint to the column. |
26+
| `col_qualification` | An optional list of column definitions, which may include [column-level constraints](constraints.html), [collation](collate.html), or [column family assignments](column-families.html).<br><br>Note that it is not possible to add a column with the [`FOREIGN KEY`](foreign-key.html) constraint. As a workaround, you can add the column without the constraint, then use [`CREATE INDEX`](create-index.html) to index the column, and then use [`ADD CONSTRAINT`](add-constraint.html) to add the `FOREIGN KEY` constraint to the column. |
2727

2828
## Viewing schema changes
2929

@@ -33,10 +33,12 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
3333

3434
### Add a single column
3535

36+
{% include copy-clipboard.html %}
3637
~~~ sql
3738
> ALTER TABLE accounts ADD COLUMN names STRING;
3839
~~~
3940

41+
{% include copy-clipboard.html %}
4042
~~~ sql
4143
> SHOW COLUMNS FROM accounts;
4244
~~~
@@ -53,10 +55,12 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
5355

5456
### Add multiple columns
5557

58+
{% include copy-clipboard.html %}
5659
~~~ sql
5760
> ALTER TABLE accounts ADD COLUMN location STRING, ADD COLUMN amount DECIMAL;
5861
~~~
5962

63+
{% include copy-clipboard.html %}
6064
~~~ sql
6165
> SHOW COLUMNS FROM accounts;
6266
~~~
@@ -76,10 +80,12 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
7680

7781
### Add a column with a `NOT NULL` constraint and a `DEFAULT` value
7882

83+
{% include copy-clipboard.html %}
7984
~~~ sql
8085
> ALTER TABLE accounts ADD COLUMN interest DECIMAL NOT NULL DEFAULT (DECIMAL '1.3');
8186
~~~
8287

88+
{% include copy-clipboard.html %}
8389
~~~ sql
8490
> SHOW COLUMNS FROM accounts;
8591
~~~
@@ -98,29 +104,37 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
98104

99105
### Add a column with `NOT NULL` and `UNIQUE` constraints
100106

107+
{% include copy-clipboard.html %}
101108
~~~ sql
102109
> ALTER TABLE accounts ADD COLUMN cust_number DECIMAL UNIQUE NOT NULL;
103110
~~~
104111

105112
### Add a column with collation
106113

114+
{% include copy-clipboard.html %}
107115
~~~ sql
108116
> ALTER TABLE accounts ADD COLUMN more_names STRING COLLATE en;
109117
~~~
110118

111119
### Add a column and assign it to a column family
112120

113121
#### Add a column and assign it to a new column family
122+
123+
{% include copy-clipboard.html %}
114124
~~~ sql
115125
> ALTER TABLE accounts ADD COLUMN location1 STRING CREATE FAMILY new_family;
116126
~~~
117127

118128
#### Add a column and assign it to an existing column family
129+
130+
{% include copy-clipboard.html %}
119131
~~~ sql
120132
> ALTER TABLE accounts ADD COLUMN location2 STRING FAMILY existing_family;
121133
~~~
122134

123135
#### Add a column and create a new column family if column family does not exist
136+
137+
{% include copy-clipboard.html %}
124138
~~~ sql
125139
> ALTER TABLE accounts ADD COLUMN new_name STRING CREATE IF NOT EXISTS FAMILY f1;
126140
~~~

v2.1/add-constraint.md

+16-9
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ toc: false
66

77
The `ADD CONSTRAINT` [statement](sql-statements.html) is part of `ALTER TABLE` and can add the following [constraints](constraints.html) to columns:
88

9-
- [Check](check.html)
10-
- [Foreign Keys](foreign-key.html)
11-
- [Unique](unique.html)
9+
- [`CHECK`](check.html)
10+
- [`FOREIGN KEY`](foreign-key.html)
11+
- [`UNIQUE`](unique.html)
1212

1313
{{site.data.alerts.callout_info}}
14-
The <a href="primary-key.html">Primary Key</a> and <a href="not-null.html">Not Null</a> constraints can only be applied through <a href="create-table.html"><code>CREATE TABLE</code></a>. The <a href="default-value.html">Default</a> constraint is managed through <a href="alter-column.html"><code>ALTER COLUMN</code>.</a>{{site.data.alerts.end}}
14+
The [`PRIMARY KEY`](primary-key.html) and [`NOT NULL`](not-null.html) constraints can only be applied through [`CREATE TABLE`](create-table.html). The [`DEFAULT`](default-value.html) constraint is managed through [`ALTER COLUMN`](alter-column.html).
15+
{{site.data.alerts.end}}
1516

1617
<div id="toc"></div>
1718

@@ -29,7 +30,7 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
2930
|-----------|-------------|
3031
| `table_name` | The name of the table containing the column you want to constrain. |
3132
| `constraint_name` | The name of the constraint, which must be unique to its table and follow these [identifier rules](keywords-and-identifiers.html#identifiers). |
32-
| `constraint_elem` | The [Check](check.html), [Foreign Keys](foreign-key.html), [Unique](unique.html) constraint you want to add. <br/><br/>Adding/changing a Default constraint is done through [`ALTER COLUMN`](alter-column.html). <br/><br/>Adding/changing the table's Primary Key is not supported through `ALTER TABLE`; it can only be specified during [table creation](create-table.html#create-a-table-primary-key-defined). |
33+
| `constraint_elem` | The [`CHECK`](check.html), [`FOREIGN KEY`](foreign-key.html), [`UNIQUE`](unique.html) constraint you want to add. <br/><br/>Adding/changing a `DEFAULT` constraint is done through [`ALTER COLUMN`](alter-column.html). <br/><br/>Adding/changing the table's `PRIMARY KEY` is not supported through `ALTER TABLE`; it can only be specified during [table creation](create-table.html#create-a-table-primary-key-defined). |
3334

3435
## Viewing schema changes
3536

@@ -39,26 +40,29 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
3940

4041
### Add the `UNIQUE` constraint
4142

42-
Adding the [Unique constraint](unique.html) requires that all of a column's values be distinct from one another (except for *NULL* values).
43+
Adding the [`UNIQUE` constraint](unique.html) requires that all of a column's values be distinct from one another (except for *NULL* values).
4344

45+
{% include copy-clipboard.html %}
4446
~~~ sql
4547
> ALTER TABLE orders ADD CONSTRAINT id_customer_unique UNIQUE (id, customer);
4648
~~~
4749

4850
### Add the `CHECK` constraint
4951

50-
Adding the [Check constraint](check.html) requires that all of a column's values evaluate to `TRUE` for a Boolean expression.
52+
Adding the [`CHECK` constraint](check.html) requires that all of a column's values evaluate to `TRUE` for a Boolean expression.
5153

54+
{% include copy-clipboard.html %}
5255
~~~ sql
5356
> ALTER TABLE orders ADD CONSTRAINT total_0_check CHECK (total > 0);
5457
~~~
5558

5659
### Add the `FOREIGN KEY` constraint with `CASCADE`
5760

58-
Before you can add the [Foreign Key](foreign-key.html) constraint to columns, the columns must already be indexed. If they are not already indexed, use [`CREATE INDEX`](create-index.html) to index them and only then use the `ADD CONSTRAINT` statement to add the Foreign Key constraint to the columns.
61+
Before you can add the [`FOREIGN KEY`](foreign-key.html) constraint to columns, the columns must already be indexed. If they are not already indexed, use [`CREATE INDEX`](create-index.html) to index them and only then use the `ADD CONSTRAINT` statement to add the Foreign Key constraint to the columns.
5962

6063
For example, let's say you have two tables, `orders` and `customers`:
6164

65+
{% include copy-clipboard.html %}
6266
~~~ sql
6367
> SHOW CREATE TABLE customers;
6468
~~~
@@ -78,6 +82,7 @@ For example, let's say you have two tables, `orders` and `customers`:
7882
(1 row)
7983
~~~
8084

85+
{% include copy-clipboard.html %}
8186
~~~ sql
8287
> SHOW CREATE TABLE orders;
8388
~~~
@@ -100,18 +105,20 @@ For example, let's say you have two tables, `orders` and `customers`:
100105

101106
To ensure that each value in the `orders.customer_id` column matches a unique value in the `customers.id` column, you want to add the Foreign Key constraint to `orders.customer_id`. So you first create an index on `orders.customer_id`:
102107

108+
{% include copy-clipboard.html %}
103109
~~~ sql
104110
> CREATE INDEX ON orders (customer_id);
105111
~~~
106112

107-
Then you add the Foreign Key constraint.
113+
Then you add the `FOREIGN KEY` constraint.
108114

109115
You can include a [foreign key action](foreign-key.html#foreign-key-actions) to specify what happens when a foreign key is updated or deleted.
110116

111117
In this example, let's use `ON DELETE CASCADE` (i.e., when referenced row is deleted, all dependent objects are also deleted).
112118

113119
{{site.data.alerts.callout_danger}}<code>CASCADE</code> does not list objects it drops or updates, so it should be used cautiously.{{site.data.alerts.end}}
114120

121+
{% include copy-clipboard.html %}
115122
~~~ sql
116123
> ALTER TABLE orders ADD CONSTRAINT customer_fk FOREIGN KEY (customer_id) REFERENCES customers (id) ON DELETE CASCADE;
117124
~~~

v2.1/admin-ui-access-and-navigate.md

+15-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ The built-in Admin UI gives you essential metrics about a cluster's health, such
1212

1313
You can access the Admin UI from any node in the cluster.
1414

15-
{{site.data.alerts.callout_info}}By default, CockroachDB allows all users to access and view the Admin UI. For secure clusters, you can choose to <a href="#secure-the-admin-ui">enable user authentication</a> to restrict access to the Admin UI to authorized users. {{site.data.alerts.end}}
15+
{{site.data.alerts.callout_info}}
16+
By default, CockroachDB allows all users to access and view the Admin UI. For secure clusters, you can choose to [enable user authentication](#secure-the-admin-ui) to restrict access to the Admin UI to authorized users.
17+
{{site.data.alerts.end}}
1618

1719
By default, you can access it via HTTP on port `8080` of the hostname or IP address you configured using the `--host` flag while [starting the node](https://www.cockroachlabs.com/docs/stable/start-a-node.html#general). For example, `http://<any node host>:8080`. If you are running a secure cluster, use `https://<any node host>:8080`.
1820

@@ -22,7 +24,7 @@ For additional guidance on accessing the Admin UI in the context of cluster depl
2224

2325
## Navigate the Admin UI
2426

25-
The left-hand navigation bar allows you to navigate to the [Cluster Overview page](admin-ui-access-and-navigate.html), [Cluster metrics dashboards](admin-ui-overview.html), [Databases page](admin-ui-databases-page.html), and [Jobs page](admin-ui-jobs-page.html).
27+
The left-hand navigation bar allows you to navigate to the [Cluster Overview page](admin-ui-access-and-navigate.html), [cluster metrics dashboards](admin-ui-overview.html), [Databases page](admin-ui-databases-page.html), and [Jobs page](admin-ui-jobs-page.html).
2628

2729
The main panel displays changes for each page:
2830

@@ -110,7 +112,8 @@ You can hover over each graph to see actual point-in-time values.
110112

111113
<img src="{{ 'images/v2.1/admin_ui_hovering.gif' | relative_url }}" alt="CockroachDB Admin UI" style="border:1px solid #eee;max-width:100%" />
112114

113-
{{site.data.alerts.callout_info}}By default, CockroachDB stores timeseries metrics for the last 30 days, but you can reduce the interval for timeseries storage. Alternately, if you are exclusively using a third-party tool such as <a href="monitor-cockroachdb-with-prometheus.html">Prometheus</a> for timeseries monitoring, you can disable timeseries storage entirely. For more details, see this <a href="operational-faqs.html#can-i-reduce-or-disable-the-storage-of-timeseries-data">FAQ</a>.
115+
{{site.data.alerts.callout_info}}
116+
By default, CockroachDB stores timeseries metrics for the last 30 days, but you can reduce the interval for timeseries storage. Alternately, if you are exclusively using a third-party tool such as [Prometheus](monitor-cockroachdb-with-prometheus.html) for timeseries monitoring, you can disable timeseries storage entirely. For more details, see this [FAQ](operational-faqs.html#can-i-reduce-or-disable-the-storage-of-timeseries-data).
114117
{{site.data.alerts.end}}
115118

116119
#### Change time range
@@ -175,7 +178,9 @@ The following types of events are listed:
175178

176179
By default, CockroachDB allows all users to access and view the Admin UI. However, for secure clusters, you can choose to enable user authentication</a> to restrict access to authorized users.
177180

178-
{{site.data.alerts.callout_danger}}<strong>This feature is a work in progress</strong>. It will change leading up to the v2.1 release.{{site.data.alerts.end}}
181+
{{site.data.alerts.callout_danger}}
182+
**This feature is a work in progress**. It will change leading up to the v2.1 release.
183+
{{site.data.alerts.end}}
179184

180185
1. Start a secure cluster as described in our [deployment tutorials](manual-deployment.html).
181186

@@ -190,3 +195,9 @@ By default, CockroachDB allows all users to access and view the Admin UI. Howeve
190195
2. For each user who should have access to the Admin UI, [create a user with a password](create-user.html).
191196

192197
On accessing the Admin UI, these users will see a Login screen, where they will need to enter their usernames and passwords.
198+
199+
## See also
200+
201+
- [Troubleshooting Overview](troubleshooting-overview.html)
202+
- [Support Resources](support-resources.html)
203+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-custom-chart-debug-page.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Options include:
4040

4141
To compare system vs. userspace CPU usage, select the following values under **Metric Name**:
4242

43-
+ `sys.cpu.sys.percent`
44-
+ `sys.cpu.user.percent`
43+
- `sys.cpu.sys.percent`
44+
- `sys.cpu.user.percent`
4545

4646
The Y-axis label is the **Count**. A count of 1 represents 100% utilization. The **Aggregator** of **Sum** can show the count to be above 1, which would mean CPU utilization is greater than 100%.
4747

@@ -57,6 +57,6 @@ This list is taken directly from the source code and is subject to change. Some
5757

5858
## See also
5959

60-
+ [Troubleshooting Overview](troubleshooting-overview.html)
61-
+ [Support Resources](support-resources.html)
62-
+ [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)
60+
- [Troubleshooting Overview](troubleshooting-overview.html)
61+
- [Support Resources](support-resources.html)
62+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-databases-page.md

+6
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ The **Grants** view shows the [privileges](privileges.html) granted to users for
3030
For more details about grants and privileges, see [Grants](grant.html).
3131

3232
<img src="{{ 'images/v2.1/admin_ui_database_grants_view.png' | relative_url }}" alt="CockroachDB Admin UI Database Grants View" style="border:1px solid #eee;max-width:100%" />
33+
34+
## See also
35+
36+
- [Troubleshooting Overview](troubleshooting-overview.html)
37+
- [Support Resources](support-resources.html)
38+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-jobs-page.md

+6
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ Filter By | Description
2424
Job Status | From the **Status** menu, select the required status filter.
2525
Job Type | From the **Type** menu, select **Backups**, **Restores**, **Imports**, or **Schema Changes**.
2626
Jobs Shown | From the **Show** menu, select **First 50** or **All**.
27+
28+
## See also
29+
30+
- [Troubleshooting Overview](troubleshooting-overview.html)
31+
- [Support Resources](support-resources.html)
32+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-overview-dashboard.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ Ranges are subsets of your data, which are replicated to ensure survivability. R
4040

4141
For details about how to control the number and location of replicas, see [Configure Replication Zones](configure-replication-zones.html).
4242

43-
{{site.data.alerts.callout_info}}The timeseries data used to power the graphs in the Admin UI is stored within the cluster and accumulates for 30 days before it starts getting truncated. As a result, for the first 30 days or so of a cluster's life, you will see a steady increase in disk usage and the number of ranges even if you aren't writing data to the cluster yourself. For more details, see this <a href="operational-faqs.html#why-is-disk-usage-increasing-despite-lack-of-writes">FAQ</a>.{{site.data.alerts.end}}
43+
{{site.data.alerts.callout_info}}
44+
The timeseries data used to power the graphs in the Admin UI is stored within the cluster and accumulates for 30 days before it starts getting truncated. As a result, for the first 30 days or so of a cluster's life, you will see a steady increase in disk usage and the number of ranges even if you aren't writing data to the cluster yourself. For more details, see this [FAQ](operational-faqs.html#why-is-disk-usage-increasing-despite-lack-of-writes).
45+
{{site.data.alerts.end}}
4446

4547
## Capacity
4648

@@ -63,3 +65,9 @@ Used | Disk space used by the data in the CockroachDB store. Note that this valu
6365
{{site.data.alerts.callout_info}}
6466
{% include available-capacity-metric.md %}
6567
{{site.data.alerts.end}}
68+
69+
## See also
70+
71+
- [Troubleshooting Overview](troubleshooting-overview.html)
72+
- [Support Resources](support-resources.html)
73+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-overview.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ Area | Description
2525

2626
The Admin UI also provides details about the way data is **Distributed**, the state of specific **Queues**, and metrics for **Slow Queries**, but these details are largely internal and intended for use by CockroachDB developers.
2727

28-
{{site.data.alerts.callout_info}}By default, the Admin UI shares anonymous usage details with Cockroach Labs. For information about the details shared and how to opt-out of reporting, see <a href="diagnostics-reporting.html">Diagnostics Reporting</a>.{{site.data.alerts.end}}
28+
{{site.data.alerts.callout_info}}
29+
By default, the Admin UI shares anonymous usage details with Cockroach Labs. For information about the details shared and how to opt-out of reporting, see [Diagnostics Reporting](diagnostics-reporting.html).
30+
{{site.data.alerts.end}}
31+
32+
## See also
33+
34+
- [Troubleshooting Overview](troubleshooting-overview.html)
35+
- [Support Resources](support-resources.html)
36+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-replication-dashboard.md

+6
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@ The **Replication** dashboard shows other time series graphs that are important
9090
- Range Operations
9191

9292
For monitoring CockroachDB, it is sufficient to use the [**Ranges**](#ranges), [**Replicas per Store**](#replicas-per-store), and [**Replica Quiescence**](#replica-quiescence) graphs.
93+
94+
## See also
95+
96+
- [Troubleshooting Overview](troubleshooting-overview.html)
97+
- [Support Resources](support-resources.html)
98+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-runtime-dashboard.md

+6
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,9 @@ The **Runtime** dashboard shows other time series graphs that are important for
6868
- GC Pause Time
6969

7070
For monitoring CockroachDB, it is sufficient to use the [**Live Node Count**](#live-node-count), [**Memory Usage**](#memory-usage), [**CPU Time**](#cpu-time), and [**Clock Offset**](#clock-offset) graphs.
71+
72+
## See also
73+
74+
- [Troubleshooting Overview](troubleshooting-overview.html)
75+
- [Support Resources](support-resources.html)
76+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

v2.1/admin-ui-sql-dashboard.md

+6
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,9 @@ The **SQL** dashboard shows other time series graphs that are important for Cock
6767
- Schema Changes
6868

6969
For monitoring CockroachDB, it is sufficient to use the [**SQL Connections**](#sql-connections), [**SQL Byte Traffic**](#sql-byte-traffic), [**SQL Queries**](#sql-queries), [**Service Latency**](#service-latency), and [**Transactions**](#transactions) graphs.
70+
71+
## See also
72+
73+
- [Troubleshooting Overview](troubleshooting-overview.html)
74+
- [Support Resources](support-resources.html)
75+
- [Raw Status Endpoints](monitoring-and-alerting.html#raw-status-endpoints)

0 commit comments

Comments
 (0)