cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
30.03k stars 3.8k forks source link

stats: consider truncating deeply-nested json objects used as upper bounds #121749

Open yuzefovich opened 6 months ago

yuzefovich commented 6 months ago

Here is inuse_objects view from one of the CC clusters. It is dominated by allocations for deeply-nested json objects. Screenshot 2024-04-03 at 5 41 13 PM

We should consider truncating such datums before using them as upper bound.

I've looked at many CC clusters, and upper bound datums in general are often very prominent as inuse_objects, but json datums seem particularly noticeable.

Jira issue: CRDB-37489

DrewKimball commented 6 months ago

[triage] There's a truncateDatum function that handles this for other data types - we should extend it to handle JSON. Note: the issue here isn't necessarily the absolute size of the JSON datum - it's the deep nesting. This may not be straightforward when multiple rows have a large shared prefix.