PostgreSQL常用命令

前端之家收集整理的这篇文章主要介绍了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

猜你在找的Postgre SQL相关文章