1. clickhouse-jdbc 使用 google 的 cityhash128 算法实现,可SELECT cityHash128(*) 查看
2.python 连接
from clickhouse_driver import Client
client = Client(host='127.0.0.1', database='ads', user='default', password='')
client.execute()
3.http 连接
echo 'SELECT 1' | curl 'http://127.0.0.1:8123/?user=&password=' -d
4.创建表
create table xxx ENGINE=MergeTree () ORDER BY day SETTINGS index_granularity = 8192
as SELECT * FROM XXXXX
同步数据
create table base1.temp3 as temp ENGINE = MergeTree PARTITION BY day ORDER BY day SETTINGS index_granularity = 8192 ; 只同步结构,省略了打字段
亦或
create table t3 ENGINE = Memory as select * from t;
5.物化列
不能insert ,也不能select * 查询, 是计算结果的一个物化隐藏列。数据实际会进行存储(查询不计算)。 建表语句如下:
create table t (a MATERIALIZED (b+1), b UInt16) ENGINE = Memory;
6.表达式列
类似物化列,但实际数据不存储。(查询需重新计算,耗费性能及时间)。 建表语句:
create table t (a ALIAS (b+1), b UInt16) ENGINE = Memory;
7.端口
9000 客户端端口
9001 自定义副本端口
9009 数据同步端口
8123 http及Tabix 端口
2181 zookeeper端口