Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tom-clickhouse/7bc8ba48b32b1c4bd39a97a4d8971b79 to your computer and use it in GitHub Desktop.

Select an option

Save tom-clickhouse/7bc8ba48b32b1c4bd39a97a4d8971b79 to your computer and use it in GitHub Desktop.
Dashboard 2 - memory usage of optimized dashboard query
SELECT
    query,
    formatReadableSize(memory_usage) AS memory_used
FROM clusterAllReplicas(default, system.query_log)
WHERE type = 'QueryFinish' AND query_id = 'previous_query_id';
┌─query────────────────────────┬─memory_used─┐
│ SELECT                      ↴│ 16.58 MiB   │
│↳  event,                    ↴│             │
│↳  sum(count) AS count,      ↴│             │
│↳  uniqMerge(users) AS users ↴│             │
│↳FROM bluesky.top_event_types↴│             │
│↳GROUP BY event              ↴│             │
│↳ORDER BY count DESC;         │             │
└──────────────────────────────┴─────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment