加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

PostgreSQL常用命令

发布时间:2020-12-13 16:54:42 所属栏目:百科 来源:网络整理
导读: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 --wit

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.52php.cn/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.52php.cn/article/p-mteekzer-ka.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读