PostgreSQL查看表、表索引、视图、表结构以及参数设置

-- 表索引
select * from pg_indexes where tablename='person_wechat_label';
select * from pg_statio_all_indexes where relname='person_wechat_label';
-- 所有表
SELECT * FROM pg_tables;
-- 所有视图
SELECT * FROM pg_views;
-- 表结构
SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a.atttypmod AS lengthvar,a.attnotnull AS notnull,b.description AS comment FROM pg_class c,pg_attribute a LEFT OUTER JOIN pg_description b ON a.attrelid=b.objoid AND a.attnum = b.objsubid,pg_type t WHERE c.relname = 'person_wechat_label' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid ORDER BY a.attnum;

参数设置:https://yq.aliyun.com/articles/697710

从数据库中导出数据到文件:\copy (select * from "user") to '/tmp/1.txt';
上一篇:sql – 如何列出所有informix数据库名称


下一篇:第25篇-虚拟机对象操作指令之putstatic