You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: v2.1/add-column.md
+15-1
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
23
23
|`table_name`| The name of the table to which you want to add the column. |
24
24
|`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. |
25
25
|`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. |
27
27
28
28
## Viewing schema changes
29
29
@@ -33,10 +33,12 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
33
33
34
34
### Add a single column
35
35
36
+
{% include copy-clipboard.html %}
36
37
~~~sql
37
38
> ALTER TABLE accounts ADD COLUMN names STRING;
38
39
~~~
39
40
41
+
{% include copy-clipboard.html %}
40
42
~~~sql
41
43
> SHOW COLUMNS FROM accounts;
42
44
~~~
@@ -53,10 +55,12 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
Copy file name to clipboardExpand all lines: v2.1/add-constraint.md
+16-9
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,13 @@ toc: false
6
6
7
7
The `ADD CONSTRAINT`[statement](sql-statements.html) is part of `ALTER TABLE` and can add the following [constraints](constraints.html) to columns:
8
8
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)
12
12
13
13
{{site.data.alerts.callout_info}}
14
-
The <ahref="primary-key.html">Primary Key</a> and <ahref="not-null.html">Not Null</a> constraints can only be applied through <ahref="create-table.html"><code>CREATE TABLE</code></a>. The <ahref="default-value.html">Default</a> constraint is managed through <ahref="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}}
15
16
16
17
<divid="toc"></div>
17
18
@@ -29,7 +30,7 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
29
30
|-----------|-------------|
30
31
|`table_name`| The name of the table containing the column you want to constrain. |
31
32
|`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). |
33
34
34
35
## Viewing schema changes
35
36
@@ -39,26 +40,29 @@ The user must have the `CREATE` [privilege](privileges.html) on the table.
39
40
40
41
### Add the `UNIQUE` constraint
41
42
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).
43
44
45
+
{% include copy-clipboard.html %}
44
46
~~~sql
45
47
> ALTER TABLE orders ADD CONSTRAINT id_customer_unique UNIQUE (id, customer);
46
48
~~~
47
49
48
50
### Add the `CHECK` constraint
49
51
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.
51
53
54
+
{% include copy-clipboard.html %}
52
55
~~~sql
53
56
> ALTER TABLE orders ADD CONSTRAINT total_0_check CHECK (total >0);
54
57
~~~
55
58
56
59
### Add the `FOREIGN KEY` constraint with `CASCADE`
57
60
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.
59
62
60
63
For example, let's say you have two tables, `orders` and `customers`:
61
64
65
+
{% include copy-clipboard.html %}
62
66
~~~sql
63
67
> SHOW CREATE TABLE customers;
64
68
~~~
@@ -78,6 +82,7 @@ For example, let's say you have two tables, `orders` and `customers`:
78
82
(1 row)
79
83
~~~
80
84
85
+
{% include copy-clipboard.html %}
81
86
~~~sql
82
87
> SHOW CREATE TABLE orders;
83
88
~~~
@@ -100,18 +105,20 @@ For example, let's say you have two tables, `orders` and `customers`:
100
105
101
106
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`:
102
107
108
+
{% include copy-clipboard.html %}
103
109
~~~sql
104
110
> CREATE INDEX ON orders (customer_id);
105
111
~~~
106
112
107
-
Then you add the Foreign Key constraint.
113
+
Then you add the `FOREIGN KEY` constraint.
108
114
109
115
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.
110
116
111
117
In this example, let's use `ON DELETE CASCADE` (i.e., when referenced row is deleted, all dependent objects are also deleted).
112
118
113
119
{{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}}
114
120
121
+
{% include copy-clipboard.html %}
115
122
~~~sql
116
123
> ALTER TABLE orders ADD CONSTRAINT customer_fk FOREIGN KEY (customer_id) REFERENCES customers (id) ON DELETE CASCADE;
Copy file name to clipboardExpand all lines: v2.1/admin-ui-access-and-navigate.md
+15-4
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,9 @@ The built-in Admin UI gives you essential metrics about a cluster's health, such
12
12
13
13
You can access the Admin UI from any node in the cluster.
14
14
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 <ahref="#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}}
16
18
17
19
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`.
18
20
@@ -22,7 +24,7 @@ For additional guidance on accessing the Admin UI in the context of cluster depl
22
24
23
25
## Navigate the Admin UI
24
26
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).
26
28
27
29
The main panel displays changes for each page:
28
30
@@ -110,7 +112,8 @@ You can hover over each graph to see actual point-in-time values.
{{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 <ahref="monitor-cockroachdb-with-prometheus.html">Prometheus</a> for timeseries monitoring, you can disable timeseries storage entirely. For more details, see this <ahref="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).
114
117
{{site.data.alerts.end}}
115
118
116
119
#### Change time range
@@ -175,7 +178,9 @@ The following types of events are listed:
175
178
176
179
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.
177
180
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}}
179
184
180
185
1. Start a secure cluster as described in our [deployment tutorials](manual-deployment.html).
181
186
@@ -190,3 +195,9 @@ By default, CockroachDB allows all users to access and view the Admin UI. Howeve
190
195
2. For each user who should have access to the Admin UI, [create a user with a password](create-user.html).
191
196
192
197
On accessing the Admin UI, these users will see a Login screen, where they will need to enter their usernames and passwords.
Copy file name to clipboardExpand all lines: v2.1/admin-ui-custom-chart-debug-page.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,8 @@ Options include:
40
40
41
41
To compare system vs. userspace CPU usage, select the following values under **Metric Name**:
42
42
43
-
+`sys.cpu.sys.percent`
44
-
+`sys.cpu.user.percent`
43
+
-`sys.cpu.sys.percent`
44
+
-`sys.cpu.user.percent`
45
45
46
46
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%.
47
47
@@ -57,6 +57,6 @@ This list is taken directly from the source code and is subject to change. Some
Copy file name to clipboardExpand all lines: v2.1/admin-ui-overview-dashboard.md
+9-1
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,9 @@ Ranges are subsets of your data, which are replicated to ensure survivability. R
40
40
41
41
For details about how to control the number and location of replicas, see [Configure Replication Zones](configure-replication-zones.html).
42
42
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 <ahref="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}}
44
46
45
47
## Capacity
46
48
@@ -63,3 +65,9 @@ Used | Disk space used by the data in the CockroachDB store. Note that this valu
Copy file name to clipboardExpand all lines: v2.1/admin-ui-overview.md
+9-1
Original file line number
Diff line number
Diff line change
@@ -25,4 +25,12 @@ Area | Description
25
25
26
26
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.
27
27
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 <ahref="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).
Copy file name to clipboardExpand all lines: v2.1/admin-ui-replication-dashboard.md
+6
Original file line number
Diff line number
Diff line change
@@ -90,3 +90,9 @@ The **Replication** dashboard shows other time series graphs that are important
90
90
- Range Operations
91
91
92
92
For monitoring CockroachDB, it is sufficient to use the [**Ranges**](#ranges), [**Replicas per Store**](#replicas-per-store), and [**Replica Quiescence**](#replica-quiescence) graphs.
Copy file name to clipboardExpand all lines: v2.1/admin-ui-runtime-dashboard.md
+6
Original file line number
Diff line number
Diff line change
@@ -68,3 +68,9 @@ The **Runtime** dashboard shows other time series graphs that are important for
68
68
- GC Pause Time
69
69
70
70
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.
Copy file name to clipboardExpand all lines: v2.1/admin-ui-sql-dashboard.md
+6
Original file line number
Diff line number
Diff line change
@@ -67,3 +67,9 @@ The **SQL** dashboard shows other time series graphs that are important for Cock
67
67
- Schema Changes
68
68
69
69
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.
0 commit comments