cockroachdb / cockroachdb/cockroach

insights, sqlstats: limit query text size

Open
#96,971 0 comments 0 reactions 0 assignees View on GitHub
A-sql-observability C-bug T-observability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

Currently, we don't limit the size of the query text stored in both the sqlstats system (memory and on-disk), and insights system (memory). This differs from the cluster_queries table where we enforce a maximum of 1000 characters for the sql text shown.
On the client side, we at least limit the length of the query text returned in the query for txn insights, but we do not do this for the stmt insights api/query.

We may want to reconsider and enforce a maximum query text size to help with memory/storage limitations.

Jira issue: CRDB-24439

Contributor guide

Open the contributing guide

Research direction

Start by tracing the sqlstats and insights systems, including their memory and on-disk storage paths, then compare them with the 1000-character limit in the cluster_queries table. Review the txn insights and stmt insights API/query entry points to determine where query text is returned or persisted. Done means the maximum size and behavior are defined and consistently enforced across the named paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
api, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.