微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐