美文网首页
postgres 修改cube 默认长度

postgres 修改cube 默认长度

作者: riverlcn | 来源:发表于2019-04-16 22:59 被阅读0次

Postgresql Cube 是Postgres的多维数据模块,默认的最大维度为100。如果业务中的数据维度超过了最大的限制,可以使用多个 cube 字段表示,或者修改默认的维度长度。

官方给出的修改说明如下

To make it harder for people to break things, there is a limit of 100 on the number of dimensions of cubes. This is set in cubedata.h if you need something bigger.

参考了 oelmekki/postgres-350dDockerfile,最终修改后的 Dockerfile,如下。

FROM postgres:10.7 AS cube-builder
MAINTAINER River Liu <ljathit@gmail.com>

ENV PG_VERSION 10.7

RUN set -xe \
    &&  apt-get update && apt-get install -y build-essential curl postgresql-server-dev-10 \
    && curl https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2 -o /postgresql-$PG_VERSION.tar.bz2 \
    && cd / && tar xvf postgresql-$PG_VERSION.tar.bz2 \
    && cd /postgresql-10.7/contrib/cube && sed -i 's/#define CUBE_MAX_DIM (100)/#define CUBE_MAX_DIM (256)/' cubedata.h \
    && USE_PGXS=true make \
    && USE_PGXS=true make install 

FROM postgres:10.7
COPY --from=cube-builder /usr/lib/postgresql/10/lib/cube.so /usr/lib/postgresql/10/lib/

基础镜像使用 postgres:10.7,然后下载源码,编译 cube 模块,并替换镜像中的 cube.so 文件。

可以通过如下命令,下载本文中的镜像文件

docker pull riverlcn/postgres

相关文章

网友评论

      本文标题:postgres 修改cube 默认长度

      本文链接:https://www.haomeiwen.com/subject/ndrwwqtx.html