Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC-12277 Add contention examples using crdb_internal.transaction_contention_events #19377

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f78b690
Draft - Added monitor-and-analyze-contention.md with images.
florence-crl Feb 14, 2025
af956b3
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Feb 14, 2025
6db1672
fixed links
florence-crl Feb 14, 2025
786c833
Draft - Added monitor-and-analyze-transaction-contention.md up to Con…
florence-crl Feb 14, 2025
fa6a527
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Feb 14, 2025
f1ed6c9
Draft - Added monitor-and-analyze-transaction-contention.md up to Ana…
florence-crl Feb 18, 2025
a4339c8
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Feb 18, 2025
46480bb
fix links
florence-crl Feb 18, 2025
3199fed
fix links
florence-crl Feb 18, 2025
22ac238
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Feb 20, 2025
e5c73a6
Draft - Added monitor-and-analyze-transaction-contention.md up to Ana…
florence-crl Feb 20, 2025
4c65490
fix link.
florence-crl Feb 21, 2025
efca702
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Feb 21, 2025
6a95b07
Added monitor-and-analyze-transaction-contention.md up to Analyze usi…
florence-crl Feb 21, 2025
efe9416
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Mar 11, 2025
e144a38
Incorporated Jon St. John’s feedback.
florence-crl Mar 11, 2025
fce2217
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Mar 12, 2025
d9f5693
Incorporated DavidH and Xin’s comments from slack.
florence-crl Mar 13, 2025
46d5fd8
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Mar 13, 2025
a87b314
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Mar 17, 2025
2f1ae56
Incorporated suggestions from docs-reviewer-gpt.
florence-crl Mar 17, 2025
689e127
Merge remote-tracking branch 'origin/main' into DOC-12277
florence-crl Mar 17, 2025
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 @@ -57,6 +57,12 @@
"/${VERSION}/admission-control.html"
]
},
{
"title": "Monitor and Analyze Transaction Contention",
"urls": [
"/${VERSION}/monitor-and-analyze-transaction-contention.html"
]
},
{
"title": "Performance Tuning Recipes",
"urls": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Column | Type | Description
-------|------|------------
`collection_ts` | `TIMESTAMPTZ NOT NULL` | The timestamp when the transaction [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention) event was collected.
`blocking_txn_id` | `UUID NOT NULL` | The ID of the blocking transaction. You can join this column into the [`cluster_contention_events`]({% link {{ page.version.version }}/crdb-internal.md %}#cluster_contention_events) table.
`blocking_txn_fingerprint_id` | `BYTES NOT NULL`| The ID of the blocking transaction fingerprint. To surface historical information about the transactions that caused the [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention), you can join this column into the [`statement_statistics`]({% link {{ page.version.version }}/crdb-internal.md %}#statement_statistics) and [`transaction_statistics`]({% link {{ page.version.version }}/crdb-internal.md %}#transaction_statistics) tables.
`waiting_txn_id` | `UUID NOT NULL` | The ID of the waiting transaction. You can join this column into the [`cluster_contention_events`]({% link {{ page.version.version }}/crdb-internal.md %}#cluster_contention_events) table.
`waiting_txn_fingerprint_id` | `BYTES NOT NULL` | The ID of the waiting transaction fingerprint. To surface historical information about the transactions that caused the [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention), you can join this column into the [`statement_statistics`]({% link {{ page.version.version }}/crdb-internal.md %}#statement_statistics) and [`transaction_statistics`]({% link {{ page.version.version }}/crdb-internal.md %}#transaction_statistics) tables.
`waiting_stmt_id` | `STRING NOT NULL` | The statement id of the transaction that was waiting (unique for each statement execution).
`waiting_stmt_fingerprint_id` | `BYTES NOT NULL` | The ID of the waiting statement fingerprint. To surface historical information about the statements that caused the [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention), you can join this column into the [`statement_statistics`]({% link {{ page.version.version }}/crdb-internal.md %}#statement_statistics) table.
`contention_duration` | `INTERVAL NOT NULL` | The interval of time the waiting transaction spent waiting for the blocking transaction.
`contending_key` | `BYTES NOT NULL` | The key on which the transactions contended.
`contending_pretty_key` | `STRING NOT NULL` | The specific key that was involved in the contention event, in readable format.
`database_name` | `STRING NOT NULL` | The database where the contention occurred.
`schema_name` | `STRING NOT NULL` | The schema where the contention occurred.
`table_name` | `STRING NOT NULL` | The table where the contention occurred.
`index_name` | `STRING NULL` | The index where the contention occurred.
`contention_type` | `STRING NOT NULL` | The type of contention. Possible values:<ul><li>`LOCK_WAIT`: Indicates that the transaction waited on a specific key. The record includes the key and the wait duration.</li><li>`SERIALIZATION_CONFLICT`: Represents a serialization conflict specific to a transaction execution. This is recorded only when a [client-side retry error]({% link {{ page.version.version }}/transaction-retry-error-reference.md %}) containing the conflicting transaction details is emitted.</li></ul>After recording, the `contention_type` is not modified. A transaction may have multiple `LOCK_WAIT` events, as they correspond to specific keys, but only one `SERIALIZATION_CONFLICT` event.
Binary file added src/current/images/v25.1/contention-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/current/images/v25.1/contention-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/current/images/v25.1/contention-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/current/images/v25.1/contention-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/current/images/v25.1/contention-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/current/images/v25.1/contention-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 1 addition & 9 deletions src/current/v25.1/crdb-internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -1173,15 +1173,7 @@ Contention events are stored in memory. You can control the amount of contention

The `sql.contention.event_store.duration_threshold` [cluster setting]({% link {{ page.version.version }}/cluster-settings.md %}) specifies the minimum contention duration to cause the contention events to be collected into the `crdb_internal.transaction_contention_events` table. The default value is `0`. If contention event collection is overwhelming the CPU or memory you can raise this value to reduce the load.

Column | Type | Description
------------|-----|------------
`collection_ts` | `TIMESTAMPTZ NOT NULL` | The timestamp when the transaction [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention) event was collected.
`blocking_txn_id` | `UUID NOT NULL` | The ID of the blocking transaction. You can join this column into the [`cluster_contention_events`](#cluster_contention_events) table.
`blocking_txn_fingerprint_id` | `BYTES NOT NULL`| The ID of the blocking transaction fingerprint. To surface historical information about the transactions that caused the [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention), you can join this column into the [`statement_statistics`](#statement_statistics) and [`transaction_statistics`](#transaction_statistics) tables to surface historical information about the transactions that caused the contention.
`waiting_txn_id` | `UUID NOT NULL` | The ID of the waiting transaction. You can join this column into the [`cluster_contention_events`](#cluster_contention_events) table.
`waiting_txn_fingerprint_id` | `BYTES NOT NULL` | The ID of the waiting transaction fingerprint. To surface historical information about the transactions that caused the [contention]({% link {{ page.version.version }}/performance-best-practices-overview.md %}#transaction-contention), you can join this column into the [`statement_statistics`](#statement_statistics) and [`transaction_statistics`](#transaction_statistics) tables.
`contention_duration` | `INTERVAL NOT NULL` | The interval of time the waiting transaction spent waiting for the blocking transaction.
`contending_key` | `BYTES NOT NULL` | The key on which the transactions contended.
{% include {{ page.version.version }}/transaction-contention-events-columns.md %}

#### Transaction contention - example

Expand Down
Loading
Loading