Skip to content

Instantly share code, notes, and snippets.

View marliotto's full-sized avatar

Vitaly Gridasov marliotto

  • Russia, Krasnodar
View GitHub Profile
@marliotto
marliotto / sysctl.conf
Created June 9, 2018 12:14 — forked from AysadKozanoglu/sysctl.conf
high secure & perfornce debian sysctl.conf setting - debian sysctl yüksek güven ve performans ayarlari
# Kernel sysctl configuration file for Linux
# Version 1.11 - 2015-07-07
# Aysad Kozanoglu Aysad K.
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
#
# Tested with: Ubuntu 14.04 LTS kernel version 3.13
drop table if exists states_raw;
drop table if exists final_states_by_month;
drop table if exists final_states_by_month_mv;
CREATE TABLE states_raw(d date, uid UInt64, s String) ENGINE = Null;
CREATE TABLE final_states_by_month(d date, uid UInt64, a_state AggregateFunction(groupArray, String))
ENGINE = AggregatingMergeTree PARTITION BY toYYYYMM(d) ORDER BY (uid);
CREATE MATERIALIZED VIEW final_states_by_month_mv TO final_states_by_month AS
SELECT d, uid, groupArrayState(s) a_state FROM states_raw GROUP BY d, uid;