Postgres表分区按表达式排列

问题描述 投票:0回答:1

我是Postgres的桌面分区的新手,我正在尝试一些似乎不起作用的东西。这是问题的简化版本:

cREATE table if not exists Location1 
PARTITION OF "Location"
FOR VALUES FROM
(extract(epoch from now()::timestamp))  
TO 
(extract(epoch from now()::timestamp)) ;

insert into "Location" ("BuyerId", "Location") 
values (416177285, point(-100, 100));

它失败了:

ERROR:  syntax error at or near "extract"
LINE 2:     FOR VALUES FROM (extract(epoch from now()::timestamp))

如果我尝试使用文字值创建分区,它可以正常工作。

我在linux上使用Postgres 10。

postgresql database-partitioning postgresql-10
1个回答
-1
投票

经过大量的反复试验,我意识到Postgres 10并没有开箱即用的完整分区系统。对于可用的分区数据库,需要安装以下postgres模块:

pg_partman https://github.com/pgpartman/pg_partman(字面意思是上帝的礼物)

pg_jobmon https://github.com/omniti-labs/pg_jobmon(监视pg_partman正在做什么)

以上建议适合那些刚接触现场的人,帮助您避免很多麻烦。

我认为postgres-core自动创建分区是不费脑子的,但显然postgres开发者知道我不知道的事情吗?

如果要求80的任何关系数据库插入一行,则在通过约束检查后成功。

最新版本的Postgres 2018被要求插入一行:“抱歉,我不知道该把它放在哪里。”

这是一个很好的第一次努力,但希望Postgres 11将有一个适当的分区系统OOTB ...

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.