1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| # db CREATE DATABASE dp;
# table use dp; CREATE TABLE random_data_max ( date String, val UInt8, timestamp Datetime64 )ENGINE=MergeTree() PARTITION by toYYYYMMDD(timestamp) ORDER BY timestamp;
# data insert INSERT INTO random_data_max(date, val,timestamp) SELECT today(), number,now() FROM numbers(100);
# db infos | 压缩率信息等 select database, table, formatReadableSize(size) as size, formatReadableSize(bytes_on_disk) as bytes_on_disk, formatReadableSize(data_uncompressed_bytes) as data_uncompressed_bytes, formatReadableSize(data_compressed_bytes) as data_compressed_bytes, compress_rate, rows, days, formatReadableSize(avgDaySize) as avgDaySize from ( select database, table, sum(bytes) as size, sum(rows) as rows, min(min_date) as min_date, max(max_date) as max_date, sum(bytes_on_disk) as bytes_on_disk, sum(data_uncompressed_bytes) as data_uncompressed_bytes, sum(data_compressed_bytes) as data_compressed_bytes, (data_compressed_bytes / data_uncompressed_bytes) * 100 as compress_rate, max_date - min_date as days, size / (max_date - min_date) as avgDaySize from system.parts where active and database = 'dp' group by database, table ) FORMAT Vertical;
|