Skip to content

Introduce method to track intent counts to SQL statements #141613

Open
@kevinkokomani

Description

Is your feature request related to a problem? Please describe.

There is currently no way to track intent counts to SQL statements. This has always been an issue. It has been difficult to troubleshoot intents, and the inability to easily see which statements are laying a lot of intents has made investigations much more lengthy and involved forever.

Describe the solution you'd like

This feature request is introduce improved observability into intents, specifically being able to track which statements are currently laying intents. It would be great to also include historical information on very high-intent queries (perhaps an insight). Whether this is best handled via a query, a DB console page, an Insight, or something else, I'm unsure.

Describe alternatives you've considered

The only "alternative" method is to run the following query:

SELECT *
FROM (
	SELECT range_id, start_pretty, end_pretty, (crdb_internal.range_stats(start_key)->>'intent_count')::INT AS intent_count
	FROM crdb_internal.ranges_no_leases)
WHERE intent_count != 0 ORDER BY intent_count DESC;

Problems with this:

  1. The output isn't per SQL statement, it's per table ID. So we don't have per-statement tracking, and we can only track it to the table if we then take further steps to translate the table ID:
  range_id | start_pretty | end_pretty | intent_count
-----------+--------------+------------+---------------
        70 | /Table/104   | /Max       |        10000
  1. We don't recommend relying on the usage of crdb_internal.ranges_no_leases in production since this table is subject to change. This is in our docs: https://www.cockroachlabs.com/docs/stable/crdb-internal

Jira issue: CRDB-47935

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)O-supportWould prevent or help troubleshoot a customer escalation - bugs, missing observability/tooling, docsP-3Issues/test failures with no fix SLAT-observability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions