[root@leo opt]# cd /opt
[root@leo opt]# git clone https://github.com/postgrespro/pg_pathman

#配置下PG的home环境变量,不设置的话, 会报错如下:

make: pg_config: Command not found

原因是root下的,而pg的path是配置在postgres用户下的

[root@leo opt]#  export PATH=/home/postgres:$PATH
[root@leo opt]# cd pg_pathman
[root@leo opt]# make USE_PGXS=1
[root@leo opt]# make USE_PGXS=1 install
#更改pg的配置文件
[root@leo pg_pathman]# cd $PGDATA
[root@leo data]# vim postgresql.conf
#将shared_preload_libraries注释取消,将下面变量赋值进去
shared_preload_libraries = 'pg_pathman' 

重启:

/home/postgres/pgsql/bin/pg_ctl -D /home/postgres/pgsql/pgdata/ restart

如果报找不到 pg_stat_statements:
直接进入安装的源码包里面有 /home/postgres/postgresql-9.6.9/contrib/pg_stat_statements
root用户:

make
make install

有些时候报错,缺少openssl/ssl这个时候安装 openssl-devel

yum install openssl-devel

即可

查询表oid,并根据字段创建表分区

select oid from pg_class where relname='表名' ;

select create_hash_partitions(16514::regclass, '字段名', 300,  true);
Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐