1. 在数据库中查单个表

select pg_size_pretty(pg_relation_size('table_name'));

2. 查出并按大小排序

SELECT table_schema || '.' || table_name AS table_full_name, pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')) AS size
FROM information_schema.tables
ORDER BY pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') DESC limit 20

3. 查出表大小按大小排序并分离data与index

SELECT
table_name,
pg_size_pretty(table_size) AS table_size,
pg_size_pretty(indexes_size) AS indexes_size,
pg_size_pretty(total_size) AS total_size
FROM (
SELECT
table_name,
pg_table_size(table_name) AS table_size,
pg_indexes_size(table_name) AS indexes_size,
pg_total_relation_size(table_name) AS total_size
FROM (
SELECT ('"' || table_schema || '"."' || table_name || '"') AS table_name
FROM information_schema.tables
) AS all_tables
ORDER BY total_size DESC
) AS pretty_sizes

PostgreSQL 查看单表大小的更多相关文章

  1. postgresql 查看单个表大小

    3中方法,不论什么一个都行 方法一 ,查一个表 select pg_size_pretty(pg_relation_size('table_name')); 方法二 ,查出全部表并按大小排序 SELE ...

  2. postgresql 查看数据库,表,索引,表空间以及大小

    转载 http://blog.51yip.com/pgsql/1525.html 1,查看数据库 playboy=> \l //\加上字母l,相当于mysql的,mysql> show d ...

  3. mysql单表大小的限制

    mysql单表大小的限制一.MySQL数据库的MyISAM存储 引擎单表大小限制已经不是有MySQL数据库本身来决定(限制扩大到64pb),而是由所在主机的OS上面的文件系统来决定了.在mysql5. ...

  4. sql查看所有表大小的方法

    sql查看所有表大小的方法. 代码: declare @id int ) declare @pages int declare @dbname sysname ,) ,) ,) create tabl ...

  5. mysql工具——使用mysqlshow查看mysql对象信息,查看mysql表大小

    关键词:查看表大小,mysqlshow mysqlshow --count -uroot -p test

  6. SQL Server查看所有表大小、表行数和占用空间信息

    一.查看表名和对应的数据行数select  a.name as '表名',b.rows as '表数据行数'from sysobjects a inner join sysindexes bon a. ...

  7. SQL Server查看所有表大小,所占空间

    create table #Data(name varchar(100),row varchar(100),reserved varchar(100),data varchar(100),index_ ...

  8. 查看mysql表大小

    //先进去MySQL自带管理库:information_schema //自己的数据库:dbwww58com_kuchecarlib //自己的表:t_carmodelparamvalue mysql ...

  9. 查看mysql 表大小

    select round(sum(DATA_LENGTH / 1024 / 1024 ), 2) from `information_schema`.`tables` where table_sche ...

随机推荐

  1. thinkphp中ajax技术

    thinkphp可以直接返回json数据,json数据事可以跟前端的js通用的

  2. Spring Cache扩展:注解失效时间+主动刷新缓存(二)

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  3. 微信小程序tab(swiper)切换

    <- wxml -> <view class="youhui"> <view ' bindtap='toggle'> 未使用 </view ...

  4. python3+beautifulSoup4.6抓取某网站小说(四)多线程抓取

    上一篇多文章,是二级目录,根目录"小说",二级目录"作品名称",之后就是小说文件. 本篇改造了部分代码,将目录设置为根目录->作者目录->作品目录- ...

  5. C# 使用 GDI+ 实现添加中心旋转(任意角度)的文字

    这篇文章是 GDI+ 总结系列的第三篇,如果对 GDI+ 的基础使用不熟悉的朋友可以先看第一篇文章<C# 使用 GDI+ 画图>. 需求 需求是要实现给图片添加任意角度旋转的文字,文字的旋 ...

  6. groovy入门(2-1)Groovy的Maven插件安装:Plugin execution not covered by lifecycle configuration

    参考链接:http://www.cnblogs.com/rightmin/p/4945797.html 1.引入groovy的jar包 2.引入groovy编译插件 3.遇到问题 Plugin exe ...

  7. jquery-模仿qq提示消息

    ( function() { var ua = navigator.userAgent.toLowerCase(); var is = (ua.match(/\b(chrome|opera|safar ...

  8. 关于PHP包含文件的方法

    Begin 今天陆陆续续在重新写一些后台程序,用到了一些共用的PHP文件,所以顺便学习了一下几种包含文件方式 include 最常用的包含文件方法,如果遇到错误会显示warning,但是不会影响下面脚 ...

  9. 数据库“行专列”操作---使用row_number()over(partition by 分组字段 [order by 排序字段])

    测试样例: create table test(rsrp string,rsrq string,tkey string,distan string); '); '); '); '); select * ...

  10. requests+xpath+map爬取百度贴吧

    # requests+xpath+map爬取百度贴吧 # 目标内容:跟帖用户名,跟帖内容,跟帖时间 # 分解: # requests获取网页 # xpath提取内容 # map实现多线程爬虫 impo ...