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

前端之家收集整理的这篇文章主要介绍了postgresql 查看page, index, tuple 详细信息前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

下面的内容需要理解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,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.f2er.com/postgresql/194357.html

猜你在找的Postgre SQL相关文章