From 7249efdacedcf0aabe649b04657934a94b0a2ecc Mon Sep 17 00:00:00 2001 From: Florence Morris Date: Thu, 2 May 2024 12:44:39 -0400 Subject: [PATCH 1/4] (1) Added _includes/v23.2/ui/statement-fingerprints.md as a copy of ./_includes/common/ui/statements-page.md. (2) Added _includes/v24.1/ui/statement-fingerprints.md as a copy of ./_includes/common/ui/statements-page.md and modified for this feature. (3) In v23.2 and v24.1 ui-statements-page.md and ./cockroachcloud/statements-page.md, replace _includes/common/ui/statements-page.md with _includes/VERSION/ui/statement-fingerprints.md. (4) In ./_includes/v24.1/ui/statements-table.md, replaced Failed? with Failure Count. --- .../v23.2/ui/statement-fingerprints.md | 44 +++++++++++++++++++ .../v24.1/ui/statement-fingerprints.md | 43 ++++++++++++++++++ .../_includes/v24.1/ui/statements-table.md | 2 +- src/current/cockroachcloud/statements-page.md | 2 +- src/current/v23.2/ui-statements-page.md | 2 +- src/current/v24.1/ui-statements-page.md | 2 +- 6 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 src/current/_includes/v23.2/ui/statement-fingerprints.md create mode 100644 src/current/_includes/v24.1/ui/statement-fingerprints.md diff --git a/src/current/_includes/v23.2/ui/statement-fingerprints.md b/src/current/_includes/v23.2/ui/statement-fingerprints.md new file mode 100644 index 00000000000..c60dc441f57 --- /dev/null +++ b/src/current/_includes/v23.2/ui/statement-fingerprints.md @@ -0,0 +1,44 @@ +{% if page.cloud == true %} + {% capture link_prefix %}../{{site.current_cloud_version}}/{% endcapture %} + {% assign page_prefix = "" %} +{% else %} + {% assign link_prefix = "" %} + {% assign page_prefix = "ui-" %} +{% endif %} + +### Example + +See [View historical statement statistics and the sampled logical plan per fingerprint]({{ link_prefix }}crdb-internal.html#view-historical-statement-statistics-and-the-sampled-logical-plan-per-fingerprint). + +## SQL statement fingerprints + +The Statements page displays SQL statement fingerprints. + +A _statement fingerprint_ represents one or more SQL statements by replacing literal values (e.g., numbers and strings) with underscores (`_`). This can help you quickly identify frequently executed SQL statements and their latencies. + +For multiple SQL statements to be represented by a fingerprint, they must be identical aside from their literal values and placeholders. + +These SQL statements: + +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (380, 11, 11098)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (192, 891, 20)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (784, 452, 78)` + +have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (_, _, _)` + +These SQL statements: + +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, 11098)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($3, $4, 300)` + +have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $1, _)`. + +The following statements are not represented by either fingerprint: + +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, 11, 11098)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, $3)` + +It is possible to see the same fingerprint listed multiple times in the following scenarios: + +- Statements with this fingerprint were executed by more than one [`application_name`]({{ link_prefix }}show-vars.html#supported-variables). +- Statements with this fingerprint were executed both successfully and unsuccessfully. diff --git a/src/current/_includes/v24.1/ui/statement-fingerprints.md b/src/current/_includes/v24.1/ui/statement-fingerprints.md new file mode 100644 index 00000000000..e9955463aed --- /dev/null +++ b/src/current/_includes/v24.1/ui/statement-fingerprints.md @@ -0,0 +1,43 @@ +{% if page.cloud == true %} + {% capture link_prefix %}../{{site.current_cloud_version}}/{% endcapture %} + {% assign page_prefix = "" %} +{% else %} + {% assign link_prefix = "" %} + {% assign page_prefix = "ui-" %} +{% endif %} + +### Example + +See [View historical statement statistics and the sampled logical plan per fingerprint]({{ link_prefix }}crdb-internal.html#view-historical-statement-statistics-and-the-sampled-logical-plan-per-fingerprint). + +## SQL statement fingerprints + +The Statements page displays SQL statement fingerprints. + +A _statement fingerprint_ represents one or more SQL statements by replacing literal values (e.g., numbers and strings) and placeholders with underscores (`_`). Lists with only literals or placeholders and similar expressions are shortened to their first item followed by `__more__`. + +Fingerprints can help you quickly identify frequently executed SQL statements and their latencies. + +For multiple SQL statements to be represented by a fingerprint, they must be identical aside from their literal values and placeholders. + +These SQL statements: + +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (380, 11, 11098)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (192, 891, 20)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (784, 452, 78)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, 11098)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($3, $4, 300)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, 11, 11098)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, $3)` + +have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (_, __more__)` + +The following statements are not represented by the preceding fingerprint: + +- INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (380, 11, 11098, 1); +- INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (192, 891, 20, 2); +- INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (784, 452, 78, 3); + +Instead, they have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (_, __more__)` + +It is possible to see the same fingerprint listed multiple times when statements with this fingerprint were executed by more than one [`application_name`]({{ link_prefix }}show-vars.html#supported-variables). diff --git a/src/current/_includes/v24.1/ui/statements-table.md b/src/current/_includes/v24.1/ui/statements-table.md index 321d3f06f80..c61f6b80a2f 100644 --- a/src/current/_includes/v24.1/ui/statements-table.md +++ b/src/current/_includes/v24.1/ui/statements-table.md @@ -32,7 +32,7 @@ Diagnostics | Activate and download [diagnostics](#diagnostics) for this fingerp {{site.data.alerts.callout_info}} To obtain the execution statistics, CockroachDB samples a percentage of the executions. If you see `no samples` displayed in the **Contention**, **Max Memory**, or **Network** columns, there are two possibilities: - Your statement executed successfully but wasn't sampled because there were too few executions of the statement. -- Your statement has failed (the most likely case). You can confirm by clicking the statement and viewing the value for **Failed?**. +- Your statement has failed (the most likely case). You can confirm by clicking the statement and viewing the value for **Failure Count**. {{site.data.alerts.end}} To view statement details, click a SQL statement fingerprint in the **Statements** column to open the **Statement Fingerprint** page. diff --git a/src/current/cockroachcloud/statements-page.md b/src/current/cockroachcloud/statements-page.md index 79677985097..1d894dbba2e 100644 --- a/src/current/cockroachcloud/statements-page.md +++ b/src/current/cockroachcloud/statements-page.md @@ -16,7 +16,7 @@ docs_area: manage {% include {{version_prefix}}ui/statistics.md %} -{% include common/ui/statements-page.md %} +{% include {{version_prefix}}ui/statement-fingerprints.md %} {% include {{version_prefix}}ui/statements-table.md %} diff --git a/src/current/v23.2/ui-statements-page.md b/src/current/v23.2/ui-statements-page.md index 8bd2cf6610c..dbdb69988b4 100644 --- a/src/current/v23.2/ui-statements-page.md +++ b/src/current/v23.2/ui-statements-page.md @@ -15,7 +15,7 @@ docs_area: reference.db_console {% include {{ page.version.version }}/ui/statistics.md %} -{% include common/ui/statements-page.md %} +{% include {{ page.version.version }}/ui/statement-fingerprints.md %} {% include {{ page.version.version }}/ui/statements-table.md %} diff --git a/src/current/v24.1/ui-statements-page.md b/src/current/v24.1/ui-statements-page.md index 8bd2cf6610c..dbdb69988b4 100644 --- a/src/current/v24.1/ui-statements-page.md +++ b/src/current/v24.1/ui-statements-page.md @@ -15,7 +15,7 @@ docs_area: reference.db_console {% include {{ page.version.version }}/ui/statistics.md %} -{% include common/ui/statements-page.md %} +{% include {{ page.version.version }}/ui/statement-fingerprints.md %} {% include {{ page.version.version }}/ui/statements-table.md %} From 5c08b2b7e3fbe1b418a32d6686bd6c13634177a4 Mon Sep 17 00:00:00 2001 From: Florence Morris Date: Thu, 2 May 2024 12:56:49 -0400 Subject: [PATCH 2/4] fixed statement formatting --- src/current/_includes/v24.1/ui/statement-fingerprints.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/current/_includes/v24.1/ui/statement-fingerprints.md b/src/current/_includes/v24.1/ui/statement-fingerprints.md index e9955463aed..05d0c8a87c1 100644 --- a/src/current/_includes/v24.1/ui/statement-fingerprints.md +++ b/src/current/_includes/v24.1/ui/statement-fingerprints.md @@ -34,9 +34,9 @@ have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction The following statements are not represented by the preceding fingerprint: -- INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (380, 11, 11098, 1); -- INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (192, 891, 20, 2); -- INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (784, 452, 78, 3); +- `INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (380, 11, 11098, 1)`; +- `INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (192, 891, 20, 2)`; +- `INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (784, 452, 78, 3)`; Instead, they have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id, item_count) VALUES (_, __more__)` From 6deb471447373458166efabe2d0ee59e55e222dd Mon Sep 17 00:00:00 2001 From: Florence Morris Date: Tue, 7 May 2024 12:00:47 -0400 Subject: [PATCH 3/4] =?UTF-8?q?Incorporated=20Xin=E2=80=99s=20feedback.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_includes/v23.2/ui/statement-fingerprints.md | 10 +++++----- .../_includes/v24.1/ui/statement-fingerprints.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/current/_includes/v23.2/ui/statement-fingerprints.md b/src/current/_includes/v23.2/ui/statement-fingerprints.md index c60dc441f57..ef34814e529 100644 --- a/src/current/_includes/v23.2/ui/statement-fingerprints.md +++ b/src/current/_includes/v23.2/ui/statement-fingerprints.md @@ -24,19 +24,19 @@ These SQL statements: - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (192, 891, 20)` - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (784, 452, 78)` -have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (_, _, _)` +have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (_, _, __more1_10__)` These SQL statements: - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, 11098)` -- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($3, $4, 300)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, 300)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, $3)` -have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $1, _)`. +have the fingerprint `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $1, __more1_10__)`. -The following statements are not represented by either fingerprint: +The following statement is not represented by either of the preceding fingerprints: - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, 11, 11098)` -- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, $3)` It is possible to see the same fingerprint listed multiple times in the following scenarios: diff --git a/src/current/_includes/v24.1/ui/statement-fingerprints.md b/src/current/_includes/v24.1/ui/statement-fingerprints.md index 05d0c8a87c1..40a033a43dc 100644 --- a/src/current/_includes/v24.1/ui/statement-fingerprints.md +++ b/src/current/_includes/v24.1/ui/statement-fingerprints.md @@ -26,7 +26,7 @@ These SQL statements: - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (192, 891, 20)` - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES (784, 452, 78)` - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, 11098)` -- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($3, $4, 300)` +- `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, 300)` - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, 11, 11098)` - `INSERT INTO new_order(product_id, customer_id, transaction_id) VALUES ($1, $2, $3)` From 6c1c045e59a628b822b3571e319ecf93b69638f6 Mon Sep 17 00:00:00 2001 From: Florence Morris Date: Thu, 16 May 2024 10:11:01 -0400 Subject: [PATCH 4/4] =?UTF-8?q?Incorporated=20Ryan=E2=80=99s=20feedback.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/current/_includes/v23.2/ui/statement-fingerprints.md | 2 +- src/current/_includes/v24.1/ui/statement-fingerprints.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/current/_includes/v23.2/ui/statement-fingerprints.md b/src/current/_includes/v23.2/ui/statement-fingerprints.md index ef34814e529..58df9c303b2 100644 --- a/src/current/_includes/v23.2/ui/statement-fingerprints.md +++ b/src/current/_includes/v23.2/ui/statement-fingerprints.md @@ -12,7 +12,7 @@ See [View historical statement statistics and the sampled logical plan per finge ## SQL statement fingerprints -The Statements page displays SQL statement fingerprints. +The **Statements** page displays SQL statement fingerprints. A _statement fingerprint_ represents one or more SQL statements by replacing literal values (e.g., numbers and strings) with underscores (`_`). This can help you quickly identify frequently executed SQL statements and their latencies. diff --git a/src/current/_includes/v24.1/ui/statement-fingerprints.md b/src/current/_includes/v24.1/ui/statement-fingerprints.md index 40a033a43dc..45c96044406 100644 --- a/src/current/_includes/v24.1/ui/statement-fingerprints.md +++ b/src/current/_includes/v24.1/ui/statement-fingerprints.md @@ -12,7 +12,7 @@ See [View historical statement statistics and the sampled logical plan per finge ## SQL statement fingerprints -The Statements page displays SQL statement fingerprints. +The **Statements** page displays SQL statement fingerprints. A _statement fingerprint_ represents one or more SQL statements by replacing literal values (e.g., numbers and strings) and placeholders with underscores (`_`). Lists with only literals or placeholders and similar expressions are shortened to their first item followed by `__more__`.