Created
February 20, 2019 18:12
-
-
Save e0da/6794045857f0d3df37a31ad11ba027a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cur.execute(<<-'SQL'.gsub('%s', tablename)) | |
INSERT INTO `%s` | |
SELECT cs.nodeid, dbs.name database, rels.name `table`, | |
reps.name `index`, sum(reads) reads, | |
sum(deletes+inserts+replaces) writes, | |
count(cs.replica) replicas | |
FROM system.`databases` AS dbs | |
JOIN system.`relations` AS rels USING (db) | |
JOIN system.`representations` AS reps | |
ON (reps.relation = rels.table) | |
JOIN system.`slices` AS s USING (representation) | |
JOIN system.`replicas` AS r USING (slice) | |
JOIN system.container_stats AS cs USING (replica) | |
GROUP BY nodeid, `database`, `table`, `index` | |
% tablename) | |
SQL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment