pg_pathman使用总结
pg_pathman安装
1)使用yum命令安装:
yum install pg_pathman95.x86_64
2)安装完成之后,在pg配置文件postgresql.conf配置文件中增加扩展配置:
shared_preload_libraries = 'pg_pathman'
3)重启pg数据库;
pg_pathman应用
1)创建测试库
postgres=# create database pathman_test;
postgres=# \c pathman_test
--按log_time字段按月分表,所以log_time字段不能为null
pathman_test=# create table pgpath_test(id serial, log_time timestamp not null,
description text);
2) 按照log_time字段分表,按月分子表;此时未range分表方式;
pathman_test=# select create_range_partitions
pathman_test-# ('pgpath_test'::regclass, --主表OID
pathman_test(# 'log_time', --分区列名,必须有not null约束
pathman_test(# '2018-01-