资讯专栏INFORMATION COLUMN

postgresql 查看page, index, tuple 详细信息

stefanieliang / 3400人阅读

摘要:下面的内容需要理解术语需要用到查询详细信息查看所有的含有需要子段的

下面的内容需要理解postgres术语 page, tuple, regclass, relname. sql command 需要用到 pgstattuple,pageinspect extension.

Setup Extension
  create extension pgstatuple
  create extension pageinspect 
  
查询page, index 详细信息

show how many pages in one table
select pg_relpages(regclass)

show one table tuple information
select * from pgstattuple(regclass)

show one table index information
select * from pgstatindex(regclass)

show one page information
select * from page_header(get_raw_page(relname text, "main", page number))

show one page all tuples information
select * from heap_page_items(get_raw_page(relname text, "main", page number))

show one index information
select * from bt_metap(relname text);

show one index page information
select * from bt_page_stats(relname text, page number)

show one index page all tuples information
select * from bt_page_items(relname text, page number)

查看database 所有的含有需要toast子段的table
select t1.relid, t1.schemaname, t1.relname, t2.relid, t2.schemaname, t2.relname from pg_stat_all_tables t1 inner join pg_stat_all_tables t2 on "pg_toast_"|| t1.relid = t2.relname and t1.schemaname = "public"

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/38952.html

相关文章

  • SQLAlchemy in 查询空列表问题分析

    摘要:收集有关数据库中表的内容的统计信息。预计的该规划节点的行平均宽度单位字节。其中上层节点的开销将包括其所有子节点的开销。一般而言,顶层的行预计数量会更接近于查询实际返回的行数。 问题场景 有model Account,SQLAlchemy 查询语句如下: query = Account.query.filter(Account.id.in_(account_ids)).order_by(...

    lsxiao 评论0 收藏0
  • SQLAlchemy in 查询空列表问题分析

    摘要:收集有关数据库中表的内容的统计信息。预计的该规划节点的行平均宽度单位字节。其中上层节点的开销将包括其所有子节点的开销。一般而言,顶层的行预计数量会更接近于查询实际返回的行数。 问题场景 有model Account,SQLAlchemy 查询语句如下: query = Account.query.filter(Account.id.in_(account_ids)).order_by(...

    joy968 评论0 收藏0
  • SQLAlchemy in 查询空列表问题分析

    摘要:收集有关数据库中表的内容的统计信息。预计的该规划节点的行平均宽度单位字节。其中上层节点的开销将包括其所有子节点的开销。一般而言,顶层的行预计数量会更接近于查询实际返回的行数。 问题场景 有model Account,SQLAlchemy 查询语句如下: query = Account.query.filter(Account.id.in_(account_ids)).order_by(...

    mating 评论0 收藏0
  • 深入解析 PostgreSQL 系列之并发控制与事务机制

    摘要:深入解析系列之并发控制与事务机制并发控制旨在针对数据库中对事务并行的场景,保证中的一致性与隔离。启动并执行第一个命令。事务管理器分配,并返回事务快照,因为正在进行中。意味着该行由另一个并发事务更新,并且其事务尚未终止。 showImg(https://segmentfault.com/img/remote/1460000018081793); 深入解析 PostgreSQL 系列整理...

    JohnLui 评论0 收藏0

发表评论

0条评论

stefanieliang

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<