GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pixelweb-org/granulee: Finds storage and schema improvements on ClickHouse servers and measures them on a sample before you apply them.

BranchesTags
Open more actions menu

Latest commit

 

History

102 Commits
102 Commits

Folders and files

NameName
Last commit message
Last commit date
.claude
.claude
 
 
.github
.github
 
 
backend
backend
 
 
deploy
deploy
 
 
dev
dev
 
 
docs
docs
 
 
frontend
frontend
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
.release-please-manifest.json
.release-please-manifest.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
release-please-config.json
release-please-config.json
 
 
version.txt
version.txt
 
 

Repository files navigation

Granulee

Granulee finds storage and schema improvements on ClickHouse servers and measures them on a sample of your data before you apply them.

It reads a server's system tables and query log, proposes changes to codecs, data types, sorting and partition keys and skip indexes, and then runs a trial: a baseline table and a candidate table in a scratch database, filled with the same rows, merged, measured and queried side by side with the queries your server actually ran. You see what a change does to size, inserts and every replayed query before a single statement touches the production table.

A finished trial: one verdict, then what got better, worse and what cannot be told apart

What it does

  • Scans a server from its system tables: sizes, compression, parts, codecs, types, keys, skip indexes and projections. Table data is not read.
  • Recommends changes to partitioning, sorting keys, codecs, data types and skip indexes. Sorting-key and index findings come from what the logged queries filter on, which ClickHouse itself resolves with EXPLAIN QUERY TREE.
  • Shows how a table is used: SELECT and INSERT volume, the columns read and filtered on, the most frequent query shapes.
  • Measures indexes instead of guessing: every logged query is planned with EXPLAIN indexes = 1, so you see what each skip index, projection and key actually drops. On servers with EXPLAIN WHATIF, candidate indexes are estimated before anything is built.
  • Takes slow queries apart: the costliest logged queries of a table, cut into subqueries and clauses you can run one at a time, with advice on how to write them better and a run of the rewrite next to the original.
  • Runs trials on a sample: size per column, column scans, insert throughput, replayed queries with their plans, and on request every sensible codec per column. A timing only counts as better or worse outside the server's own run-to-run noise.
  • Applies a candidate when you confirm it: ALTER TABLE statements are shown and run from the page, a rebuild script for key changes is only shown.

What Granulee does, in detail covers each of these.

Speed step of a trial: every replayed query on one scale Indexes and projections of a table with the queries that use them

Quick start

You need Docker. This starts Granulee on http://localhost:8080:

docker run -d --name granulee -p 127.0.0.1:8080:8080 -v granulee-data:/data ghcr.io/pixelweb-org/granulee:latest

The first start creates the user admin and prints its one-time password once, to the container's log:

docker logs granulee

Open http://localhost:8080, sign in with it and choose your own password. Then go to Data sources and add your ClickHouse server (HTTP or HTTPS endpoint, user, password). The first scan starts right away.

The image is built for amd64 and arm64. Every release is also tagged with its version, such as ghcr.io/pixelweb-org/granulee:0.19.4. To build it from a checkout instead, see Running Granulee.

Nothing but the sign-in is reachable without an account. An admin adds further users under Users; every user has their own data sources, scans and trials and sees nobody else's. Before you let others reach it, read Running Granulee.

Try it on sample data first

With a JDK (17 or newer) and Node 22 or newer you can run everything locally, including a ClickHouse container with a sample schema that has findings:

make clickhouse seed   # ClickHouse 25.8 on port 18123 with sample data and a query-log workload
make dev               # backend on :8080, frontend dev server on :5173

The backend prints the one-time password of admin in that terminal. Sign in on http://localhost:5173, choose a password, then:

GRANULEE_USER=admin GRANULEE_PASSWORD='…' make source   # adds that ClickHouse as your data source and scans it

Then open http://localhost:5173.

The ClickHouse user

For scans and recommendations a user that can read the system tables is enough:

CREATE USER granulee IDENTIFIED WITH sha256_password BY '…';
GRANT SELECT ON system.* TO granulee;

Query analysis, the index checks and trials need more: SELECT on the tables themselves and a scratch database to build trial tables in. ClickHouse access lists the grants per feature and what each one is used for.

Documentation

  • Running Granulee: Docker, Compose, the jar, configuration, data directory, users, security.
  • ClickHouse access: grants per feature, the query log, what is read and written.
  • What Granulee does, in detail: scans, recommendations, indexes, codecs.
  • Trials: how a trial runs, how to read its result, applying a candidate.
  • Development: layout, build, tests, releases.

Compatibility and limits

  • Developed and tested against ClickHouse 25.8 and 26.9. Projections are listed from 24.9 on; EXPLAIN ANALYZE and EXPLAIN WHATIF are used where the server has them and left out where not.
  • Only MergeTree-family tables are scanned. Only HTTP and HTTPS endpoints are supported.
  • Without a readable system.query_log, a scan still covers sizes, codecs, types, partitioning and file counts, and says why the log is unavailable and how to switch it on.
  • Savings in recommendations are estimates. A trial measures them.

License

MIT

About

Finds storage and schema improvements on ClickHouse servers and measures them on a sample before you apply them.

Topics

clickhousecodecscompressiondatabasedatabase-toolskotlinolapperformancequery-analysisreactschema-optimizationself-hostedspring-bootstorage-optimizationtypescript

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

4 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.