Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- Routines cannot be created with an `OUT` parameter of type `RECORD`. [#123448](https://github.com/cockroachdb/cockroach/issues/123448)
- DDL statements (e.g., `CREATE TABLE`, `CREATE INDEX`) are not allowed within UDFs or stored procedures. [#110080](https://github.com/cockroachdb/cockroach/issues/110080)
- Polymorphic types cannot be cast to other types (e.g., `TEXT`) within routine parameters. [#123536](https://github.com/cockroachdb/cockroach/issues/123536)
- Routine parameters and return types cannot be declared using the `ANYENUM` polymorphic type, which is able to match any [`ENUM`]({% link {{ page.version.version }}/enum.md %}) type. [123048](https://github.com/cockroachdb/cockroach/issues/123048)
- Routine parameters and return types cannot be declared using the `ANYENUM` polymorphic type, which is able to match any [`ENUM`]({% link {{ page.version.version }}/enum.md %}) type. [123048](https://github.com/cockroachdb/cockroach/issues/123048)
- Statement diagnostics cannot be collected for statements executed within UDFs or stored procedures. Statement diagnostics continue to work only for top-level statement executions. [#156905](https://github.com/cockroachdb/cockroach/pull/156905)
4 changes: 4 additions & 0 deletions src/current/_includes/v26.1/ui/statements-views.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ The **Statements Fingerprints** view helps you:
- View SQL statement fingerprint [details](#statement-fingerprint-page).
- Download SQL statement [diagnostics](#diagnostics) for troubleshooting.

{{site.data.alerts.callout_info}}
The **Statements** page displays all SQL statements, including those executed within [user-defined functions]({{ link_prefix}}user-defined-functions.html#statement-statistics) and [stored procedures]({{ link_prefix}}stored-procedures.html#statement-statistics). This allows you to monitor the performance of individual statements within your functions and procedures.
{{site.data.alerts.end}}

{% if page.cloud != true %}
To view this page, click **SQL Activity** in the left-hand navigation of the DB Console.
{% else %}
Expand Down
10 changes: 10 additions & 0 deletions src/current/v26.1/stored-procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ CREATE PROCEDURE procedure_name(parameters)

For details, see [`CREATE PROCEDURE`]({% link {{ page.version.version }}/create-procedure.md %}).

## Statement statistics

SQL statements executed within stored procedures are tracked in the SQL statistics subsystem and will appear in the [**SQL Activity** > **Statements**]({% link {{ page.version.version }}/ui-statements-page.md %}) page and the [**Insights**]({% link {{ page.version.version }}/ui-insights-page.md %}) page in the DB Console. This allows you to monitor the performance and execution statistics of individual statements within your procedures.

These statements will also appear in the [**Transaction details**]({% link {{ page.version.version }}/ui-transactions-page.md %}#transaction-details-page) in the **Statement Fingerprints** table when the stored procedure is invoked as part of a transaction.

{{site.data.alerts.callout_info}}
Statement diagnostics cannot be collected for statements executed within stored procedures. Statement diagnostics continue to work only for top-level statement executions. For details, see [Known limitations](#known-limitations).
{{site.data.alerts.end}}

## Examples

{% include {{page.version.version}}/sql/movr-statements.md %}
Expand Down
4 changes: 4 additions & 0 deletions src/current/v26.1/transaction-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Transaction diagnostics allow operators and support engineers to investigate iss
Requesting a transaction diagnostics bundle introduces performance overhead. This feature is primarily intended for use under the guidance of [Cockroach Labs Support](https://support.cockroachlabs.com/).
{{site.data.alerts.end}}

{{site.data.alerts.callout_info}}
Transaction diagnostics cannot be collected for statements executed within [user-defined functions]({% link {{ page.version.version }}/user-defined-functions.md %}) or [stored procedures]({% link {{ page.version.version }}/stored-procedures.md %}). Transaction diagnostics continue to work only for top-level statement executions.
{{site.data.alerts.end}}

## Required privileges

To use this function on a [secure cluster]({% link {{ page.version.version }}/secure-a-cluster.md %}), you must be an [`admin` user]({% link {{ page.version.version }}/security-reference/authorization.md %}#admin-role) or a SQL user with the [`VIEWACTIVITY`]({% link {{ page.version.version }}/security-reference/authorization.md %}#viewactivity) or [`VIEWACTIVITYREDACTED`]({% link {{ page.version.version }}/security-reference/authorization.md %}#viewactivityredacted) [system privilege]({% link {{ page.version.version }}/security-reference/authorization.md %}#supported-privileges). If the user has only `VIEWACTIVITYREDACTED`, they can request only redacted bundles.
Expand Down
10 changes: 10 additions & 0 deletions src/current/v26.1/user-defined-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ The basic components of a user-defined function are a name, list of arguments, r
- Can reference tables.
- Can reference only the `SELECT` statement.

## Statement statistics

SQL statements executed within user-defined functions are tracked in the SQL statistics subsystem and will appear in the [**SQL Activity** > **Statements**]({% link {{ page.version.version }}/ui-statements-page.md %}) page and the [**Insights**]({% link {{ page.version.version }}/ui-insights-page.md %}) page in the DB Console. This allows you to monitor the performance and execution statistics of individual statements within your functions.

These statements will also appear in the [**Transaction details**]({% link {{ page.version.version }}/ui-transactions-page.md %}#transaction-details-page) in the **Statement Fingerprints** table when the UDF is invoked as part of a transaction.

{{site.data.alerts.callout_info}}
Statement diagnostics cannot be collected for statements executed within UDFs. Statement diagnostics continue to work only for top-level statement executions. For details, see [Known limitations](#known-limitations).
{{site.data.alerts.end}}

## Examples

### Create a UDF
Expand Down
Loading