Skip to content

Instantly share code, notes, and snippets.

@Sh4pe
Last active May 31, 2021 08:45
Show Gist options
  • Save Sh4pe/1660b523547bee3ab9b8bd1d29d12e87 to your computer and use it in GitHub Desktop.
Save Sh4pe/1660b523547bee3ab9b8bd1d29d12e87 to your computer and use it in GitHub Desktop.
// Count unique values for each tag in a bucket
import "influxdata/influxdb/schema"
cardinalityByTag = (bucket) =>
schema.tagKeys(bucket: bucket)
|> map(fn: (r) => ({
tag: r._value,
_value:
if contains(set: ["_stop","_start"], value:r._value) then 0
else (schema.tagValues(bucket: bucket, tag: r._value)
|> count()
|> findRecord(fn: (key) => true, idx: 0))._value
}))
|> group(columns:["tag"])
|> sum()
cardinalityByTag(bucket: "statisticaldata_downsampled_1h")

Memory tweaking configurations what we've identified so far.

  • query-initial-memory-bytes
  • query-max-memory-bytes
  • query-memory-bytes
  • query-queue-size
  • storage-cache-max-memory-size
  • storage-cache-snapshot-memory-size
  • storage-cache-snapshot-write-cold-duration
  • storage-compact-full-write-cold-duration
  • storage-compact-throughput-burst
  • storage-max-concurrent-compactions
  • storage-max-index-log-file-size
  • storage-series-file-max-concurrent-snapshot-compactions
  • storage-series-id-set-cache-size
  • storage-shard-precreator-advance-period
  • storage-shard-precreator-check-interval
  • storage-wal-fsync-delay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment