Server IP : 103.119.228.120 / Your IP : 3.145.112.23 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/share/doc/postgresql-9.2.24/html/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >pgstattuple</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.2.24 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Additional Supplied Modules" HREF="contrib.html"><LINK REL="PREVIOUS" TITLE="pg_stat_statements" HREF="pgstatstatements.html"><LINK REL="NEXT" TITLE="pg_trgm" HREF="pgtrgm.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2017-11-06T22:43:11"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.2.24 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="pg_stat_statements" HREF="pgstatstatements.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="contrib.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Appendix F. Additional Supplied Modules</TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="pg_trgm" HREF="pgtrgm.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="PGSTATTUPLE" >F.29. pgstattuple</A ></H1 ><P > The <TT CLASS="FILENAME" >pgstattuple</TT > module provides various functions to obtain tuple-level statistics. </P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN151240" >F.29.1. Functions</A ></H2 ><P ></P ><DIV CLASS="VARIABLELIST" ><DL ><DT ><CODE CLASS="FUNCTION" >pgstattuple(text) returns record</CODE ></DT ><DD ><P > <CODE CLASS="FUNCTION" >pgstattuple</CODE > returns a relation's physical length, percentage of <SPAN CLASS="QUOTE" >"dead"</SPAN > tuples, and other info. This may help users to determine whether vacuum is necessary or not. The argument is the target relation's name (optionally schema-qualified). For example: </P><PRE CLASS="PROGRAMLISTING" >test=> SELECT * FROM pgstattuple('pg_catalog.pg_proc'); -[ RECORD 1 ]------+------- table_len | 458752 tuple_count | 1470 tuple_len | 438896 tuple_percent | 95.67 dead_tuple_count | 11 dead_tuple_len | 3157 dead_tuple_percent | 0.69 free_space | 8932 free_percent | 1.95</PRE ><P> The output columns are described in <A HREF="pgstattuple.html#PGSTATTUPLE-COLUMNS" >Table F-23</A >. </P ><DIV CLASS="TABLE" ><A NAME="PGSTATTUPLE-COLUMNS" ></A ><P ><B >Table F-23. <CODE CLASS="FUNCTION" >pgstattuple</CODE > Output Columns</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Column</TH ><TH >Type</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="STRUCTFIELD" >table_len</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Physical relation length in bytes</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >tuple_count</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Number of live tuples</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >tuple_len</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Total length of live tuples in bytes</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >tuple_percent</TT ></TD ><TD ><TT CLASS="TYPE" >float8</TT ></TD ><TD >Percentage of live tuples</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >dead_tuple_count</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Number of dead tuples</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >dead_tuple_len</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Total length of dead tuples in bytes</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >dead_tuple_percent</TT ></TD ><TD ><TT CLASS="TYPE" >float8</TT ></TD ><TD >Percentage of dead tuples</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >free_space</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Total free space in bytes</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >free_percent</TT ></TD ><TD ><TT CLASS="TYPE" >float8</TT ></TD ><TD >Percentage of free space</TD ></TR ></TBODY ></TABLE ></DIV ><DIV CLASS="NOTE" ><BLOCKQUOTE CLASS="NOTE" ><P ><B >Note: </B > The <TT CLASS="LITERAL" >table_len</TT > will always be greater than the sum of the <TT CLASS="LITERAL" >tuple_len</TT >, <TT CLASS="LITERAL" >dead_tuple_len</TT > and <TT CLASS="LITERAL" >free_space</TT >. The difference is accounted for by fixed page overhead, the per-page table of pointers to tuples, and padding to ensure that tuples are correctly aligned. </P ></BLOCKQUOTE ></DIV ><P > <CODE CLASS="FUNCTION" >pgstattuple</CODE > acquires only a read lock on the relation. So the results do not reflect an instantaneous snapshot; concurrent updates will affect them. </P ><P > <CODE CLASS="FUNCTION" >pgstattuple</CODE > judges a tuple is <SPAN CLASS="QUOTE" >"dead"</SPAN > if <CODE CLASS="FUNCTION" >HeapTupleSatisfiesNow</CODE > returns false. </P ></DD ><DT ><CODE CLASS="FUNCTION" >pgstattuple(oid) returns record</CODE ></DT ><DD ><P > This is the same as <CODE CLASS="FUNCTION" >pgstattuple(text)</CODE >, except that the target relation is specified by OID. </P ></DD ><DT ><CODE CLASS="FUNCTION" >pgstatindex(text) returns record</CODE ></DT ><DD ><P > <CODE CLASS="FUNCTION" >pgstatindex</CODE > returns a record showing information about a B-tree index. For example: </P><PRE CLASS="PROGRAMLISTING" >test=> SELECT * FROM pgstatindex('pg_cast_oid_index'); -[ RECORD 1 ]------+------ version | 2 tree_level | 0 index_size | 16384 root_block_no | 1 internal_pages | 0 leaf_pages | 1 empty_pages | 0 deleted_pages | 0 avg_leaf_density | 54.27 leaf_fragmentation | 0</PRE ><P> </P ><P > The output columns are: <DIV CLASS="INFORMALTABLE" ><P ></P ><A NAME="AEN151342" ></A ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Column</TH ><TH >Type</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="STRUCTFIELD" >version</TT ></TD ><TD ><TT CLASS="TYPE" >integer</TT ></TD ><TD >B-tree version number</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >tree_level</TT ></TD ><TD ><TT CLASS="TYPE" >integer</TT ></TD ><TD >Tree level of the root page</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >index_size</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Total index size in bytes</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >root_block_no</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Location of root page (zero if none)</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >internal_pages</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Number of <SPAN CLASS="QUOTE" >"internal"</SPAN > (upper-level) pages</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >leaf_pages</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Number of leaf pages</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >empty_pages</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Number of empty pages</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >deleted_pages</TT ></TD ><TD ><TT CLASS="TYPE" >bigint</TT ></TD ><TD >Number of deleted pages</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >avg_leaf_density</TT ></TD ><TD ><TT CLASS="TYPE" >float8</TT ></TD ><TD >Average density of leaf pages</TD ></TR ><TR ><TD ><TT CLASS="STRUCTFIELD" >leaf_fragmentation</TT ></TD ><TD ><TT CLASS="TYPE" >float8</TT ></TD ><TD >Leaf page fragmentation</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ><P > The reported <TT CLASS="LITERAL" >index_size</TT > will normally correspond to one more page than is accounted for by <TT CLASS="LITERAL" >internal_pages + leaf_pages + empty_pages + deleted_pages</TT >, because it also includes the index's metapage. </P ><P > As with <CODE CLASS="FUNCTION" >pgstattuple</CODE >, the results are accumulated page-by-page, and should not be expected to represent an instantaneous snapshot of the whole index. </P ></DD ><DT ><CODE CLASS="FUNCTION" >pg_relpages(text) returns bigint</CODE ></DT ><DD ><P > <CODE CLASS="FUNCTION" >pg_relpages</CODE > returns the number of pages in the relation. </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN151422" >F.29.2. Authors</A ></H2 ><P > Tatsuo Ishii and Satoshi Nagayasu </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="pgstatstatements.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="pgtrgm.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >pg_stat_statements</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="contrib.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >pg_trgm</TD ></TR ></TABLE ></DIV ></BODY ></HTML >