PostgreSQL 创建表空间测试

前端之家收集整理的这篇文章主要介绍了PostgreSQL 创建表空间测试前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Postgresql 的表空间的创建命令比较简单。

Command:     CREATE TABLESPACE
Description: define a new tablespace
Syntax:
CREATE TABLESPACE tablespace_name [ OWNER user_name ] LOCATION 'directory'
Command:     CREATE DATABASE
Description: create a new database
Syntax:
CREATE DATABASE name
    [ [ WITH ] [ OWNER [=] user_name ]
           [ TEMPLATE [=] template ]
           [ ENCODING [=] encoding ]
           [ LC_COLLATE [=] lc_collate ]
           [ LC_CTYPE [=] lc_ctype ]
           [ TABLESPACE [=] tablespace_name ]
           [ CONNECTION LIMIT [=] connlimit ] ]

可能的错误

create tablespace testspaceeee location '/mnt/data1222';
ERROR:  directory "/mnt/data1222" does not exist

表空间目录必须提前创建好。


postgresql 的归档模式设置

wal_level = archive 


checkpoint_segments = 3         # in logfile segments,min 1,16MB each
checkpoint_timeout = 10min               # 强制生成 checkpoint 的周期 
checkpoint_completion_target = 0.5      # checkpoint target duration,0.0 - 1.0
checkpoint_warning = 30s                # 0 disables
archive_mode = on # 启动归档模式
                                # 
archive_command ='cp %p /home/postgres/data1/%f'            
                                # 
                                # 
                                # 归档路径
archive_timeout = 120           # 
                                # 
原文链接:https://www.f2er.com/postgresql/194849.html

猜你在找的Postgre SQL相关文章