This commit is contained in:
poiuty 2022-07-27 11:48:27 +03:00
commit eabb01cfef
21 changed files with 921 additions and 0 deletions

View file

@ -0,0 +1,32 @@
CREATE DATABASE statbate;
USE statbate;
CREATE TABLE room
(
id Int32,
gender UInt8
) ENGINE = MySQL('127.0.0.1:3306', 'base', 'room', 'user', 'passwd');
CREATE TABLE stat
(
did UInt32,
rid UInt32,
token UInt32,
time Date,
INDEX a did TYPE bloom_filter() GRANULARITY 1,
INDEX b rid TYPE bloom_filter() GRANULARITY 1
)
ENGINE = MergeTree()
PARTITION BY toYYYYMMDD(time)
ORDER BY (time, rid, did)
PRIMARY KEY (time)
SETTINGS index_granularity = 8192;
#CREATE TABLE stat_buffer (
# did UInt32,
# rid UInt32,
# token UInt32,
# time Date
#)
#ENGINE = Buffer('statbate', 'stat', 16, 5, 30, 1000, 10000, 1000000, 10000000);

26
install/sql/stat.sql Normal file
View file

@ -0,0 +1,26 @@
CREATE TABLE `donator` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varbinary(30) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;
CREATE TABLE `room` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varbinary(30) NOT NULL,
`gender` tinyint(1) NOT NULL DEFAULT 0,
`fans` int(11) NOT NULL DEFAULT 0,
`last` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `gender` (`gender`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;
CREATE TABLE `stat` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`did` int(11) NOT NULL,
`rid` int(11) NOT NULL,
`token` int(11) NOT NULL,
`time` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=binary ROW_FORMAT=DYNAMIC;