有没有办法监控这个?
根据 Postgres Wiki’s Index Maintenance页面,您可以找到所有索引的当前状态:SELECT t.tablename,indexname,c.reltuples AS num_rows,pg_size_pretty(pg_relation_size(quote_IDent(t.tablename)::text)) AS table_size,pg_size_pretty(pg_relation_size(quote_IDent(indexrelname)::text)) AS index_size,CASE WHEN indisunique THEN 'Y' ELSE 'N' END AS UNIQUE,IDx_scan AS number_of_scans,IDx_tup_read AS tuples_read,IDx_tup_fetch AS tuples_fetchedFROM pg_tables t left OUTER JOIN pg_class c ON t.tablename=c.relname left OUTER JOIN ( SELECT c.relname AS ctablename,ipg.relname AS indexname,x.indnatts AS number_of_columns,IDx_scan,IDx_tup_read,IDx_tup_fetch,indexrelname,indisunique FROM pg_index x JOIN pg_class c ON c.oID = x.indrelID JOIN pg_class ipg ON ipg.oID = x.indexrelID JOIN pg_stat_all_indexes psai ON x.indexrelID = psai.indexrelID ) AS foo ON t.tablename = foo.ctablenameWHERE t.schemaname='public'ORDER BY 1,2;
列num_rows表示索引覆盖的行数,index_size将随着索引的构建而增长.
总结以上是内存溢出为你收集整理的监控PostgreSQL中索引构建的进展全部内容,希望文章能够帮你解决监控PostgreSQL中索引构建的进展所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)