工具使用
启动数据库
pg_ctl start -D /opt/software/postgres/data
元命令
set search_path to schemaName 设置对象默认搜索路径
set 参数名 to 值 会话级别设置参数(set enable_indexscan to off会话级关闭索引扫描)
\c dataname 切换数据库
\c dataname username 切换数据库和用户
\c - username 切换用户
\d tablename 显示表结构
\dt+ tablename 显示表大小
\du 列出数据库用户
\dn 列出数据库schema
\l 列出数据库
show 参数名 查看参数设置(如show max_connections;)
常用语句
查看数据库参数(不确定参数具体拼写时特别有用)
select name from pg_settings where name ~ '参数';