postgresql - 无法理解 postgres 中的哈希分区
问题描述
我有一个虚拟表,我在上面创建了哈希分区,比如
create table hash_test(cat int) partition by hash(cat);
create table h0 partition of hash_test for values with (modulus 2, remainder 0);
create table h1 partition of hash_test for values with (modulus 2, remainder 1);
我在那里添加了一些记录。
insert into hash_test values(0);
insert into hash_test values(1);
and so on....
当我看到两个分区时,我得到以下结果
postgres=# select * from h0;
cat
-----
0
1
2
(3 rows)
postgres=# select * from h1;
cat
-----
3
4
5
6
7
8
9
10
(8 rows)
我将哈希分区理解为, cat modulo 2 == 0 的所有行都将进入分区 h0,否则为 h1。结果与我的理解完全不符。任何人都可以帮我解决这个问题。谢谢你。
解决方案
推荐阅读
- ruby - “class << self”块内的Ruby访问类
- c++ - 在调用函数上实现 C++ 转换
- python - 需要帮助在不使用 bin() 或 hex() 等函数的情况下将十进制转换为十六进制
- kubernetes - 对 Istio ServiceRoleBinding 用户感到困惑
- python - pip 未与 python 一起安装,它不会自行安装
- c# - 检查 UWP 中的用户货币符号
- python - 仅在通用换行符处拆分 Unicode 字符串(\n、\r、\r\n)
- python - 在 Keras .h5 文件中保存自定义变量
- visual-studio - 安装2019版后会卸载Visual Studio Build Tools 2017吗?
- python - fit_generator 仍在将所有内容加载到内存中