[英]Postgres Cluster (citus): Range Query on nested jsonb column
I am using postgres 9.5.4 configured as cluster using citus 5.2 我正在使用postgres 9.5.4使用citus 5.2配置为集群
The table has been sharded using below commands. 该表已使用以下命令进行分片。
SELECT master_create_distributed_table('mytest', 'id', 'hash');
SELECT master_create_worker_shards('mytest', 16, 1);
From below sample json data stored in jsonb column, I would like to search records matching 从下面的示例json数据存储在jsonb列中,我想搜索匹配的记录
o['mid'] > 7000
This is sample of one user's record. 这是一个用户记录的样本。 There will be millions of such users.
将有数百万这样的用户。
{ "uid": 14105529, "o": [
{
"mid": 6551,
"ac": 1913,
"ip": "144.36.233.44",
"adw": 5,
"at": 133000,
"ad": 151015,
"aid": 0
},
{
"mid": 7552,
"ac": 1913,
"ip": "144.36.233.44",
"adw": 5,
"at": 133000,
"ad": 151015,
"aid": 0
},
{
"mid": 7553,
"ac": 1913,
"ip": "144.36.233.44",
"adw": 5,
"at": 133000,
"ad": 151015,
"aid": 0
} ]
}
The below query throws error, where as it executes on un-sharded table. 下面的查询抛出错误,它在未分片的表上执行。
select count(1) from mytest,jsonb_array_elements(data->'l') where (value->>'e')::bigint>7000;
ERROR: cannot perform distributed planning on this query
错误:无法对此查询执行分布式计划
DETAIL: Complex table expressions are currently unsupported
详细信息:当前不支持复杂表表达式
jsonb_array_elements(data->'l')
导致创建CTE导致此查询被拒绝,您是否可以重新编写查询以避免连接?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.