drop table tablesize
create table tablesize( phone int)
create table tablesize( phone text)
create table tablesize( phone char(30))
create table tablesize( phone varchar(3000))
create index i_table_size_phone on tablesize(phone)
insert into tablesize values('1111')
insert into tablesize values(1111)
 
select pg_size_pretty(pg_relation_size('tablesize'))--表达小,不包含索引和toast
 
select pg_size_pretty(pg_relation_size('i_table_size_phone'))--索引大小
select pg_size_pretty(pg_total_relation_size('tablesize')); --表达小包含toast,和索引大小
 
select pg_size_pretty(pg_table_size('tablesize'))--表达小,包含toast大小
 
 
select oid from pg_database where datname = 'test'
 
select pg_relation_filepath('tablesize');
 
select pg_column_size('phone')
--查看表大小和索引大小
select relname,pg_size_pretty(pg_relation_size(oid)) from pg_class where relname like '%t1%' order by relname;
 
select oid,relfilenode,relname from pg_class where relfilenode = '20221126'
select oid,relfilenode,relname from pg_class where relfilenode = '20221113'
 
pg查看表膨胀:
查看表膨胀(对所有表产进行膨胀率排序)
 
SQL文如下:
 
SELECT
schemaname||'.'||relname as table_name,
pg_size_pretty(pg_relation_size(schemaname||'.'||relname)) as table_size,
n_dead_tup,
n_live_tup,
round(n_dead_tup * 100 / (n_live_tup + n_dead_tup),2) AS dead_tup_ratio
FROM
pg_stat_all_tables
WHERE
n_dead_tup >= 1000
ORDER BY dead_tup_ratio DESC
LIMIT 10;

postgresql-查看表大小的更多相关文章

  1. PostgreSQL查看表大小的命令

    SELECT table_name, pg_size_pretty(table_size) AS table_size, pg_size_pretty(indexes_size) AS indexes ...

  2. mysql查看表大小

    mysql查看表大小 一:命令 show table status like 'table_name'\G; mysql> show table status like 'x'\G; . row ...

  3. sql server查看表大小

    查看SqlServer 数据库中各个表多少行 : SELECT A.NAME ,B.ROWS FROM sysobjects A JOIN sysindexes B ON A.id = B.id WH ...

  4. PostgreSQL查看表、表索引、视图、表结构

    -- 表索引select * from pg_indexes where tablename='person_wechat_label';select * from pg_statio_all_ind ...

  5. SQL Server 2008系统信息查询常用命令 查看表大小、记录数等

    1.返回所有数据库信息(数据库名,创建日期,存储路径等).   use master; GO select * from dbo.sysdatabases 2.返回当前数据库所有对象(可根据type字 ...

  6. MySQL 查看表大小

    当遇到数据库占用空间很大的情况下,可以用以下语句查找大数据量的表 SELECT TABLE_NAME ,),) 'DATA_SIZE(M)' ,),) 'INDEX_SIZE(M)' ,AVG_ROW ...

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

    -- 表索引select * from pg_indexes where tablename='person_wechat_label';select * from pg_statio_all_ind ...

  8. PostgreSQL 查看表、索引等创建时间

    select s.oid,s.relname,t.stausename,t.stasubtype from pg_class s,pg_stat_last_operation t where s.re ...

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

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

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

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

随机推荐

  1. Linux系统各发行版镜像下载(借阅)

    Linux各个版本资源下载 Linux系统各发行版镜像下载(持续更新) == Linux系统各发行版镜像下载(2014年10月更新),如果直接下载不了,请使用迅雷下载.并且注意,我的下载地址,在  迅 ...

  2. 手机布局rem的使用(rem)

    最后一堆代码是举例的全码. 一 直接<head>标签里套用以下,其他都不用 <script> document.documentElement.style.fontSize = ...

  3. (完全背包)Writing Code -- Codeforce 544C

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=99951#problem/C  (zznu14) Writing Code  Writin ...

  4. 关于git的ssh permission denied原因汇总

    SSH关于公钥认证Permission denied (publickey,gssapi-with-mic的问题 http://h2appy.blog.51cto.com/609721/1112797 ...

  5. 18:description方法

    本小节知识点: [掌握]description基本概念 [掌握]description重写的方法 [了解]description陷阱 1.description基本概念 NSLog(@"%@ ...

  6. node linux

    在linux下安装nodejs 教程:http://my.oschina.net/blogshi/blog/260953 连接linux服务器,supervisor bin/www,断开连接,服务器还 ...

  7. Handle( )

    Handle( ) //得到PB窗口型对象的句柄 功  能:得到PB窗口型对象的句柄.使用该函数可以得到应用对象.窗口或控件的句柄,但不能得到绘图对象的句柄. 语  法:Handle ( object ...

  8. Tencent interview

    1.常见的聚类算法 1):划分法:k-means 2):基于密度的方法: 2.EM 算法 EM算法是在概率模型中寻找参数的最大似然估计或者最大后验概率的算法,其中概率模型依赖于无法观测的隐藏变量.EM ...

  9. Android-Kotlin简单计算器功能

    上一篇博客 Android-Kotlin-配置/入门 配置好了 AndroidStudio Kotlin 的环境: 选择包名,然后右键: 选择Class类型,会有class: 创建CounterCla ...

  10. Android-Java-同步方法-synchronized

    1.方法具有封装性: /** * 1.方法具有封装性: */ public void addMoney(double moneyAsset) { this.moneyAsset += moneyAss ...