码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2019-10-16 13:43:08      阅读:125      评论:0      收藏:0      [点我收藏+]

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

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

原文地址:https://www.cnblogs.com/smallleiit/p/11684674.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!