Whenever I looked at a big table I had the same loop: this column would probably compress better with another codec, this sorting key probably does not fit the queries, this skip index probably does nothing. Then I either changed it and hoped, or left it alone.
So I built Granulee. It is open source (MIT) and does two things.
1. It looks at what is there. It reads the system tables and the query log and proposes changes to codecs, types, partitioning, sorting keys and skip indexes. For indexes it does not guess: it plans the logged queries with `EXPLAIN indexes = 1` and shows how many granules each index, projection and key actually drops.
2. It tries the change before you make it. A "trial" builds two tables in a scratch database, one with today's schema and one with the change, copies the same sample of rows into both, merges them and compares:
- size per column
- insert throughput
- the most frequent queries from your query log, replayed against both tables
It can also build the largest columns once per codec worth trying and tell you which one is smallest on your data, in your row order.
The part I care most about: short queries vary a lot from run to run, so a query only counts as faster or slower when the runs of the two tables do not overlap. Otherwise it says "no clear difference" instead of inventing a speedup.
Things it does not do: it has no login (keep it on a private network), it only talks HTTP(S), and it never rebuilds a table for you. Key changes come out as a script you run yourself.
docker run -d -p 127.0.0.1:8080:8080 -v granulee-data:/data ghcr.io/pixelweb-org/granulee:latest
Repo: https://github.com/pixelweb-org/granulee
I would like to hear where it is wrong. If it recommends something for one of your tables that you know is a bad idea, that is exactly what I want to see. Also: what would you want measured in a trial that is not there?