#openGauss #入门 #安装 #数据库 #开源
知识来源:docs-opengauss.osinfra.cn/zh/
HLL的应用场景。
-
场景1:“Hello World”
通过下面的示例说明如何使用hll数据类型:
-- 创建带有hll类型的表 openGauss=# create table helloworld (id integer, set hll); -- 向表中插入空的hll openGauss=# insert into helloworld(id, set) values (1, hll_empty()); -- 把整数经过哈希计算加入到hll中 openGauss=# update helloworld set set = hll_add(set, hll_hash_integer(12345)) where id = 1; -- 把字符串经过哈希计算加入到hll中 openGauss=# update helloworld set set = hll_add(set, hll_hash_text('hello world')) where id = 1; -- 得到hll中的distinct值 openGauss=# select hll_cardinality(set) from helloworld where id = 1; hll_cardinality ----------------- 2 (1 row) -- 删除表 openGauss=# drop table helloworld;
#openGauss #入门 #安装 #数据库 #开源