当前位置:Gxlcms > 数据库问题 > PostgreSQL查看表、表索引、视图、表结构以及参数设置

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

时间:2021-07-01 10:21:17 帮助过:34人阅读

-- 表索引
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‘;

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

标签:tle   oid   导出数据   HERE   order by   href   postgresq   hat   where   

人气教程排行