PostgreSQL常用命令

Postgresql安装

CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2
./configure --prefix=/home/pg96/pg9.6.2/pgdir --without-readline --without-zlib --enable-thread-safety --enable-rpath --enable-cassert --enable-debug CFLAGS='-03' --with-wal-segsize=64

./configure --prefix=/u01/postgres
make
sudomake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
export PGDATA=/usr/local/pgsql/data
initdb -D $PGDATA
postgres -D $PGDATA >logfile 2>&1 &
或 pg_ctl start -d$PGDATA -l pg_server.log
createdb test

pg_ctl -D $PGDATA start
pg_ctl stop -o SIGTERM SIGINT,SIGQUIT,SIGKILL
psql test
psql -d postgres -p 5432 -U benchmarksql -h 192.168.2.1
# CREATE USER benchmarksql WITH ENCRYPTED PASSWORD 'benchmarksql';
# CREATE DATABASE benchmarksql OWNER benchmarksql;
# select * from pg_database;
# vacuum full;
# vacuum analyze;
# checkpoint

\l database
\d table
\di index
\du user
show 选项

http://www.jb51.cc/article/p-ctolbgzm-pb.html


postgresql.conf

fsync=on
synchronous_commit=on
#wal_sync_method=fsync
max_connections=800
shared_buffers=100GB
max_wal_size=16GB
work_mem=128MB
full_page_writes=on
checkpoint_segments=1024
checkpoint_timeout=60min
bgwriter_delay=20ms
commit_delay=10
autovacuum=on


http://www.jb51.cc/article/p-mteekzer-ka.html

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...