Revise pgstats stuff to fix the problems with not counting accesses

generated by bitmap index scans.  Along the way, simplify and speed up
the code for counting sequential and index scans; it was both confusing
and inefficient to be taking care of that in the per-tuple loops, IMHO.
initdb forced because of internal changes in pg_stat view definitions.
This commit is contained in:
Tom Lane 2005-10-06 02:29:23 +00:00
parent b5aad11a1b
commit cb8b6618ce
16 changed files with 207 additions and 166 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.28 2005/05/09 11:31:32 neilc Exp $ $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.29 2005/10/06 02:29:06 tgl Exp $
--> -->
<chapter id="monitoring"> <chapter id="monitoring">
@ -185,11 +185,12 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
Each individual server process transmits new block and row access counts to Each individual server process transmits new block and row access counts to
the collector just before going idle; so a query or transaction still in the collector just before going idle; so a query or transaction still in
progress does not affect the displayed totals. Also, the collector itself progress does not affect the displayed totals. Also, the collector itself
emits a new report at most once per <varname>pgstat_stat_interval</varname> emits a new report at most once per <varname>PGSTAT_STAT_INTERVAL</varname>
milliseconds (500 by default). So the displayed information lags behind milliseconds (500 unless altered while building the server). So the
actual activity. Current-query information is reported to the collector displayed information lags behind actual activity. Current-query
immediately, but is still subject to the information is reported to the collector immediately, but is still subject
<varname>pgstat_stat_interval</varname> delay before it becomes visible. to the <varname>PGSTAT_STAT_INTERVAL</varname> delay before it becomes
visible.
</para> </para>
<para> <para>
@ -220,10 +221,10 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<tbody> <tbody>
<row> <row>
<entry><structname>pg_stat_activity</></entry> <entry><structname>pg_stat_activity</></entry>
<entry>One row per server process, showing process <entry>One row per server process, showing database OID, database name,
<acronym>ID</>, database, user, current query, the time at which process <acronym>ID</>, user OID, user name, current query, time at
the current query began execution, the time at which the backend which the current query began execution, time at which the process
was started and the client address and port number. The columns was started, and client's address and port number. The columns
that report data on the current query are only available if the that report data on the current query are only available if the
parameter <varname>stats_command_string</varname> has been parameter <varname>stats_command_string</varname> has been
turned on. Furthermore, these columns read as null unless the turned on. Furthermore, these columns read as null unless the
@ -235,114 +236,122 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<row> <row>
<entry><structname>pg_stat_database</></entry> <entry><structname>pg_stat_database</></entry>
<entry>One row per database, showing the number of active backend server processes, <entry>One row per database, showing database OID, database name,
total transactions committed and total rolled back in that database, number of active server processes connected to that database,
total disk blocks read, and total number of buffer hits (i.e., block number of transactions committed and rolled back in that database,
total disk blocks read, and total buffer hits (i.e., block
read requests avoided by finding the block already in buffer cache). read requests avoided by finding the block already in buffer cache).
</entry> </entry>
</row> </row>
<row> <row>
<entry><structname>pg_stat_all_tables</></entry> <entry><structname>pg_stat_all_tables</></entry>
<entry>For each table in the current database, total numbers of <entry>For each table in the current database (including TOAST tables),
sequential and index scans, total numbers of rows returned by the table OID, schema and table name, number of sequential
each type of scan, and totals of row insertions, updates, scans initiated, number of live rows fetched by sequential
and deletions.</entry> scans, number of index scans initiated (over all indexes
belonging to the table), number of live rows fetched by index
scans,
and numbers of row insertions, updates, and deletions.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_stat_sys_tables</></entry> <entry><structname>pg_stat_sys_tables</></entry>
<entry>Same as <structname>pg_stat_all_tables</>, except that only system tables <entry>Same as <structname>pg_stat_all_tables</>, except that only
are shown.</entry> system tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_stat_user_tables</></entry> <entry><structname>pg_stat_user_tables</></entry>
<entry>Same as <structname>pg_stat_all_tables</>, except that only user tables <entry>Same as <structname>pg_stat_all_tables</>, except that only user
are shown.</entry> tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_stat_all_indexes</></entry> <entry><structname>pg_stat_all_indexes</></entry>
<entry>For each index in the current database, the total number <entry>For each index in the current database,
of index scans that have used that index, the number of index rows the table and index OID, schema, table and index name,
read, and the number of successfully fetched heap rows. (This may number of index scans initiated on that index, number of
be less when there are index entries pointing to expired heap rows.) index entries returned by index scans, and number of live table rows
fetched by simple index scans using that index.
</entry> </entry>
</row> </row>
<row> <row>
<entry><structname>pg_stat_sys_indexes</></entry> <entry><structname>pg_stat_sys_indexes</></entry>
<entry>Same as <structname>pg_stat_all_indexes</>, except that only indexes on <entry>Same as <structname>pg_stat_all_indexes</>, except that only
system tables are shown.</entry> indexes on system tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_stat_user_indexes</></entry> <entry><structname>pg_stat_user_indexes</></entry>
<entry>Same as <structname>pg_stat_all_indexes</>, except that only indexes on <entry>Same as <structname>pg_stat_all_indexes</>, except that only
user tables are shown.</entry> indexes on user tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_all_tables</></entry> <entry><structname>pg_statio_all_tables</></entry>
<entry>For each table in the current database, the total number of disk <entry>For each table in the current database (including TOAST tables),
blocks read from that table, the number of buffer hits, the numbers of the table OID, schema and table name, number of disk
disk blocks read and buffer hits in all the indexes of that table, blocks read from that table, number of buffer hits, numbers of
the numbers of disk blocks read and buffer hits from the table's disk blocks read and buffer hits in all indexes of that table,
auxiliary TOAST table (if any), and the numbers of disk blocks read numbers of disk blocks read and buffer hits from that table's
auxiliary TOAST table (if any), and numbers of disk blocks read
and buffer hits for the TOAST table's index. and buffer hits for the TOAST table's index.
</entry> </entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_sys_tables</></entry> <entry><structname>pg_statio_sys_tables</></entry>
<entry>Same as <structname>pg_statio_all_tables</>, except that only system tables <entry>Same as <structname>pg_statio_all_tables</>, except that only
are shown.</entry> system tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_user_tables</></entry> <entry><structname>pg_statio_user_tables</></entry>
<entry>Same as <structname>pg_statio_all_tables</>, except that only user tables <entry>Same as <structname>pg_statio_all_tables</>, except that only
are shown.</entry> user tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_all_indexes</></entry> <entry><structname>pg_statio_all_indexes</></entry>
<entry>For each index in the current database, the numbers of <entry>For each index in the current database,
disk blocks read and buffer hits in that index. the table and index OID, schema, table and index name,
numbers of disk blocks read and buffer hits in that index.
</entry> </entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_sys_indexes</></entry> <entry><structname>pg_statio_sys_indexes</></entry>
<entry>Same as <structname>pg_statio_all_indexes</>, except that only indexes on <entry>Same as <structname>pg_statio_all_indexes</>, except that only
system tables are shown.</entry> indexes on system tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_user_indexes</></entry> <entry><structname>pg_statio_user_indexes</></entry>
<entry>Same as <structname>pg_statio_all_indexes</>, except that only indexes on <entry>Same as <structname>pg_statio_all_indexes</>, except that only
user tables are shown.</entry> indexes on user tables are shown.</entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_all_sequences</></entry> <entry><structname>pg_statio_all_sequences</></entry>
<entry>For each sequence object in the current database, the numbers <entry>For each sequence object in the current database,
of disk blocks read and buffer hits in that sequence. the sequence OID, schema and sequence name,
numbers of disk blocks read and buffer hits in that sequence.
</entry> </entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_sys_sequences</></entry> <entry><structname>pg_statio_sys_sequences</></entry>
<entry>Same as <structname>pg_statio_all_sequences</>, except that only system <entry>Same as <structname>pg_statio_all_sequences</>, except that only
sequences are shown. (Presently, no system sequences are defined, system sequences are shown. (Presently, no system sequences are defined,
so this view is always empty.)</entry> so this view is always empty.)</entry>
</row> </row>
<row> <row>
<entry><structname>pg_statio_user_sequences</></entry> <entry><structname>pg_statio_user_sequences</></entry>
<entry>Same as <structname>pg_statio_all_sequences</>, except that only user <entry>Same as <structname>pg_statio_all_sequences</>, except that only
sequences are shown.</entry> user sequences are shown.</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@ -353,6 +362,32 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
indexes are being used and how effective they are. indexes are being used and how effective they are.
</para> </para>
<para>
Beginning in <productname>PostgreSQL</productname> 8.1, indexes can be
used either directly or via <quote>bitmap scans</>. In a bitmap scan
the output of several indexes can be combined via AND or OR rules;
so it is difficult to associate individual heap row fetches
with specific indexes when a bitmap scan is used. Therefore, a bitmap
scan increments the
<structname>pg_stat_all_indexes</>.<structfield>idx_tup_read</>
count(s) for the index(es) it uses, and it increments the
<structname>pg_stat_all_tables</>.<structfield>idx_tup_fetch</>
count for the table, but it does not affect
<structname>pg_stat_all_indexes</>.<structfield>idx_tup_fetch</>.
</para>
<note>
<para>
Before <productname>PostgreSQL</productname> 8.1, the
<structfield>idx_tup_read</> and <structfield>idx_tup_fetch</> counts
were essentially always equal. Now they can be different even without
considering bitmap scans, because <structfield>idx_tup_read</> counts
index entries retrieved from the index while <structfield>idx_tup_fetch</>
counts live rows fetched from the table; the latter will be less if any
dead or not-yet-committed rows are fetched using the index.
</para>
</note>
<para> <para>
The <structname>pg_statio_</> views are primarily useful to The <structname>pg_statio_</> views are primarily useful to
determine the effectiveness of the buffer cache. When the number determine the effectiveness of the buffer cache. When the number
@ -379,9 +414,9 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
database to report on. The per-table and per-index functions take database to report on. The per-table and per-index functions take
a table or index OID. (Note that only tables and indexes in the a table or index OID. (Note that only tables and indexes in the
current database can be seen with these functions.) The current database can be seen with these functions.) The
per-backend process access functions take a backend process ID per-server-process access functions take a server process
number, which ranges from one to the number of currently active number, which ranges from one to the number of currently active
backend processes. server processes.
</para> </para>
<table id="monitoring-stats-funcs-table"> <table id="monitoring-stats-funcs-table">
@ -401,7 +436,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_db_numbackends</function>(<type>oid</type>)</literal></entry> <entry><literal><function>pg_stat_get_db_numbackends</function>(<type>oid</type>)</literal></entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry> <entry>
Number of active backend processes for database Number of active server processes for database
</entry> </entry>
</row> </row>
@ -451,7 +486,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><type>bigint</type></entry> <entry><type>bigint</type></entry>
<entry> <entry>
Number of rows read by sequential scans when argument is a table, Number of rows read by sequential scans when argument is a table,
or number of index rows read when argument is an index or number of index entries returned when argument is an index
</entry> </entry>
</row> </row>
@ -459,8 +494,8 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_tuples_fetched</function>(<type>oid</type>)</literal></entry> <entry><literal><function>pg_stat_get_tuples_fetched</function>(<type>oid</type>)</literal></entry>
<entry><type>bigint</type></entry> <entry><type>bigint</type></entry>
<entry> <entry>
Number of valid (unexpired) table rows fetched by sequential scans Number of table rows fetched by bitmap scans when argument is a table,
when argument is a table, or fetched by index scans using this index or table rows fetched by simple index scans using the index
when argument is an index when argument is an index
</entry> </entry>
</row> </row>
@ -507,10 +542,10 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<row> <row>
<entry><literal><function>pg_stat_get_backend_idset</function>()</literal></entry> <entry><literal><function>pg_stat_get_backend_idset</function>()</literal></entry>
<entry><type>set of integer</type></entry> <entry><type>setof integer</type></entry>
<entry> <entry>
Set of currently active backend process IDs (from 1 to the Set of currently active server process numbers (from 1 to the
number of active backend processes). See usage example in the text number of active server processes). See usage example in the text
</entry> </entry>
</row> </row>
@ -518,7 +553,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_backend_pid</function>()</literal></entry> <entry><literal><function>pg_backend_pid</function>()</literal></entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry> <entry>
Process ID of the backend process attached to the current session Process ID of the server process attached to the current session
</entry> </entry>
</row> </row>
@ -526,7 +561,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_backend_pid</function>(<type>integer</type>)</literal></entry> <entry><literal><function>pg_stat_get_backend_pid</function>(<type>integer</type>)</literal></entry>
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry> <entry>
Process ID of the given backend process Process ID of the given server process
</entry> </entry>
</row> </row>
@ -534,7 +569,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_backend_dbid</function>(<type>integer</type>)</literal></entry> <entry><literal><function>pg_stat_get_backend_dbid</function>(<type>integer</type>)</literal></entry>
<entry><type>oid</type></entry> <entry><type>oid</type></entry>
<entry> <entry>
Database ID of the given backend process Database ID of the given server process
</entry> </entry>
</row> </row>
@ -542,7 +577,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_backend_userid</function>(<type>integer</type>)</literal></entry> <entry><literal><function>pg_stat_get_backend_userid</function>(<type>integer</type>)</literal></entry>
<entry><type>oid</type></entry> <entry><type>oid</type></entry>
<entry> <entry>
User ID of the given backend process User ID of the given server process
</entry> </entry>
</row> </row>
@ -550,7 +585,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_backend_activity</function>(<type>integer</type>)</literal></entry> <entry><literal><function>pg_stat_get_backend_activity</function>(<type>integer</type>)</literal></entry>
<entry><type>text</type></entry> <entry><type>text</type></entry>
<entry> <entry>
Active command of the given backend process (null if the Active command of the given server process (null if the
current user is not a superuser nor the same user as that of current user is not a superuser nor the same user as that of
the session being queried, or the session being queried, or
<varname>stats_command_string</varname> is not on) <varname>stats_command_string</varname> is not on)
@ -561,7 +596,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_backend_activity_start</function>(<type>integer</type>)</literal></entry> <entry><literal><function>pg_stat_get_backend_activity_start</function>(<type>integer</type>)</literal></entry>
<entry><type>timestamp with time zone</type></entry> <entry><type>timestamp with time zone</type></entry>
<entry> <entry>
The time at which the given backend process' currently The time at which the given server process' currently
executing query was started (null if the executing query was started (null if the
current user is not a superuser nor the same user as that of current user is not a superuser nor the same user as that of
the session being queried, or the session being queried, or
@ -573,7 +608,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><literal><function>pg_stat_get_backend_start</function>(<type>integer</type>)</literal></entry> <entry><literal><function>pg_stat_get_backend_start</function>(<type>integer</type>)</literal></entry>
<entry><type>timestamp with time zone</type></entry> <entry><type>timestamp with time zone</type></entry>
<entry> <entry>
The time at which the given backend process was started, or The time at which the given server process was started, or
null if the current user is not a superuser nor the same user null if the current user is not a superuser nor the same user
as that of the session being queried as that of the session being queried
</entry> </entry>
@ -584,7 +619,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><type>inet</type></entry> <entry><type>inet</type></entry>
<entry> <entry>
The IP address of the client connected to the given The IP address of the client connected to the given
backend. Null if the connection is over a Unix domain server process. Null if the connection is over a Unix domain
socket. Also null if the current user is not a superuser nor socket. Also null if the current user is not a superuser nor
the same user as that of the session being queried the same user as that of the session being queried
</entry> </entry>
@ -595,7 +630,7 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<entry><type>integer</type></entry> <entry><type>integer</type></entry>
<entry> <entry>
The IP port number of the client connected to the given The IP port number of the client connected to the given
backend. -1 if the connection is over a Unix domain server process. -1 if the connection is over a Unix domain
socket. Null if the current user is not a superuser nor the socket. Null if the current user is not a superuser nor the
same user as that of the session being queried same user as that of the session being queried
</entry> </entry>
@ -614,8 +649,8 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<note> <note>
<para> <para>
<function>pg_stat_get_db_blocks_fetched</function> minus <function>blocks_fetched</function> minus
<function>pg_stat_get_db_blocks_hit</function> gives the number of kernel <function>blocks_hit</function> gives the number of kernel
<function>read()</> calls issued for the table, index, or <function>read()</> calls issued for the table, index, or
database; but the actual number of physical reads is usually database; but the actual number of physical reads is usually
lower due to kernel-level buffering. lower due to kernel-level buffering.
@ -624,8 +659,8 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
<para> <para>
The function <function>pg_stat_get_backend_idset</function> provides The function <function>pg_stat_get_backend_idset</function> provides
a convenient way to generate one row for each active backend process. For a convenient way to generate one row for each active server process. For
example, to show the <acronym>PID</>s and current queries of all backend processes: example, to show the <acronym>PID</>s and current queries of all server processes:
<programlisting> <programlisting>
SELECT pg_stat_get_backend_pid(s.backendid) AS procpid, SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.51 2005/09/22 20:44:36 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.52 2005/10/06 02:29:07 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -17,8 +17,10 @@
#include "access/itup.h" #include "access/itup.h"
#include "access/gist_private.h" #include "access/gist_private.h"
#include "executor/execdebug.h" #include "executor/execdebug.h"
#include "pgstat.h"
#include "utils/memutils.h" #include "utils/memutils.h"
static OffsetNumber gistfindnext(IndexScanDesc scan, OffsetNumber n, static OffsetNumber gistfindnext(IndexScanDesc scan, OffsetNumber n,
ScanDirection dir); ScanDirection dir);
static int gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, bool ignore_killed_tuples); static int gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, bool ignore_killed_tuples);
@ -161,6 +163,8 @@ gistnext(IndexScanDesc scan, ScanDirection dir, ItemPointer tids, int maxtids, b
stk->next = NULL; stk->next = NULL;
stk->block = GIST_ROOT_BLKNO; stk->block = GIST_ROOT_BLKNO;
pgstat_count_index_scan(&scan->xs_pgstat_info);
} }
else if (so->curbuf == InvalidBuffer) else if (so->curbuf == InvalidBuffer)
{ {

View File

@ -8,13 +8,14 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.38 2004/12/31 21:59:13 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.39 2005/10/06 02:29:08 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "access/hash.h" #include "access/hash.h"
#include "pgstat.h"
#include "storage/lmgr.h" #include "storage/lmgr.h"
@ -130,6 +131,8 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
ItemPointer current; ItemPointer current;
OffsetNumber offnum; OffsetNumber offnum;
pgstat_count_index_scan(&scan->xs_pgstat_info);
current = &(scan->currentItemData); current = &(scan->currentItemData);
ItemPointerSetInvalid(current); ItemPointerSetInvalid(current);

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.198 2005/08/20 00:39:51 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.199 2005/10/06 02:29:10 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
@ -47,10 +47,10 @@
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/namespace.h" #include "catalog/namespace.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "pgstat.h"
#include "storage/procarray.h" #include "storage/procarray.h"
#include "utils/inval.h" #include "utils/inval.h"
#include "utils/relcache.h" #include "utils/relcache.h"
#include "pgstat.h"
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf, static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
@ -90,6 +90,8 @@ initscan(HeapScanDesc scan, ScanKey key)
*/ */
if (key != NULL) if (key != NULL)
memcpy(scan->rs_key, key, scan->rs_nkeys * sizeof(ScanKeyData)); memcpy(scan->rs_key, key, scan->rs_nkeys * sizeof(ScanKeyData));
pgstat_count_heap_scan(&scan->rs_pgstat_info);
} }
/* ---------------- /* ----------------
@ -680,8 +682,6 @@ heap_rescan(HeapScanDesc scan,
* reinitialize scan descriptor * reinitialize scan descriptor
*/ */
initscan(scan, key); initscan(scan, key);
pgstat_reset_heap_scan(&scan->rs_pgstat_info);
} }
/* ---------------- /* ----------------
@ -762,8 +762,6 @@ heap_getnext(HeapScanDesc scan, ScanDirection direction)
return NULL; return NULL;
} }
pgstat_count_heap_scan(&scan->rs_pgstat_info);
/* /*
* if we get here it means we have a new current scan tuple, so point * if we get here it means we have a new current scan tuple, so point
* to the proper return buffer and return the tuple. * to the proper return buffer and return the tuple.
@ -927,14 +925,9 @@ heap_release_fetch(Relation relation,
*/ */
*userbuf = buffer; *userbuf = buffer;
/* /* Count the successful fetch in *pgstat_info, if given. */
* Count the successful fetch in *pgstat_info if given, otherwise
* in the relation's default statistics area.
*/
if (pgstat_info != NULL) if (pgstat_info != NULL)
pgstat_count_heap_fetch(pgstat_info); pgstat_count_heap_fetch(pgstat_info);
else
pgstat_count_heap_fetch(&relation->pgstat_info);
return true; return true;
} }
@ -1152,8 +1145,6 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
RelationPutHeapTuple(relation, buffer, tup); RelationPutHeapTuple(relation, buffer, tup);
pgstat_count_heap_insert(&relation->pgstat_info);
/* XLOG stuff */ /* XLOG stuff */
if (relation->rd_istemp) if (relation->rd_istemp)
{ {
@ -1229,6 +1220,8 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
*/ */
CacheInvalidateHeapTuple(relation, tup); CacheInvalidateHeapTuple(relation, tup);
pgstat_count_heap_insert(&relation->pgstat_info);
return HeapTupleGetOid(tup); return HeapTupleGetOid(tup);
} }
@ -1481,8 +1474,6 @@ l1:
if (HeapTupleHasExternal(&tp)) if (HeapTupleHasExternal(&tp))
heap_tuple_toast_attrs(relation, NULL, &tp); heap_tuple_toast_attrs(relation, NULL, &tp);
pgstat_count_heap_delete(&relation->pgstat_info);
/* /*
* Mark tuple for invalidation from system caches at next command * Mark tuple for invalidation from system caches at next command
* boundary. We have to do this before WriteBuffer because we need to * boundary. We have to do this before WriteBuffer because we need to
@ -1499,6 +1490,8 @@ l1:
if (have_tuple_lock) if (have_tuple_lock)
UnlockTuple(relation, &(tp.t_self), ExclusiveLock); UnlockTuple(relation, &(tp.t_self), ExclusiveLock);
pgstat_count_heap_delete(&relation->pgstat_info);
return HeapTupleMayBeUpdated; return HeapTupleMayBeUpdated;
} }
@ -1851,8 +1844,6 @@ l2:
newbuf = buffer; newbuf = buffer;
} }
pgstat_count_heap_update(&relation->pgstat_info);
/* /*
* At this point newbuf and buffer are both pinned and locked, and * At this point newbuf and buffer are both pinned and locked, and
* newbuf has enough space for the new tuple. If they are the same * newbuf has enough space for the new tuple. If they are the same
@ -1929,6 +1920,8 @@ l2:
if (have_tuple_lock) if (have_tuple_lock)
UnlockTuple(relation, &(oldtup.t_self), ExclusiveLock); UnlockTuple(relation, &(oldtup.t_self), ExclusiveLock);
pgstat_count_heap_update(&relation->pgstat_info);
return HeapTupleMayBeUpdated; return HeapTupleMayBeUpdated;
} }

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.84 2005/06/27 12:45:22 teodor Exp $ * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.85 2005/10/06 02:29:11 tgl Exp $
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
* index_open - open an index relation by relation OID * index_open - open an index relation by relation OID
@ -65,9 +65,9 @@
#include "access/genam.h" #include "access/genam.h"
#include "access/heapam.h" #include "access/heapam.h"
#include "pgstat.h"
#include "utils/relcache.h" #include "utils/relcache.h"
#include "pgstat.h"
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* macros used in index_ routines * macros used in index_ routines
@ -354,8 +354,6 @@ index_rescan(IndexScanDesc scan, ScanKey key)
FunctionCall2(procedure, FunctionCall2(procedure,
PointerGetDatum(scan), PointerGetDatum(scan),
PointerGetDatum(key)); PointerGetDatum(key));
pgstat_reset_index_scan(&scan->xs_pgstat_info);
} }
/* ---------------- /* ----------------
@ -521,8 +519,6 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
{ {
bool found; bool found;
pgstat_count_index_scan(&scan->xs_pgstat_info);
/* /*
* The AM's gettuple proc finds the next tuple matching the scan * The AM's gettuple proc finds the next tuple matching the scan
* keys. * keys.
@ -545,6 +541,8 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
return NULL; /* failure exit */ return NULL; /* failure exit */
} }
pgstat_count_index_tuples(&scan->xs_pgstat_info, 1);
/* /*
* Fetch the heap tuple and see if it matches the snapshot. * Fetch the heap tuple and see if it matches the snapshot.
*/ */
@ -583,8 +581,6 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
* initialized to 0, which is the correct state ("on row"). * initialized to 0, which is the correct state ("on row").
*/ */
pgstat_count_index_getnext(&scan->xs_pgstat_info);
return heapTuple; return heapTuple;
} }
@ -621,6 +617,9 @@ index_getnext_indexitem(IndexScanDesc scan,
PointerGetDatum(scan), PointerGetDatum(scan),
Int32GetDatum(direction))); Int32GetDatum(direction)));
if (found)
pgstat_count_index_tuples(&scan->xs_pgstat_info, 1);
return found; return found;
} }
@ -660,6 +659,8 @@ index_getmulti(IndexScanDesc scan,
Int32GetDatum(max_tids), Int32GetDatum(max_tids),
PointerGetDatum(returned_tids))); PointerGetDatum(returned_tids)));
pgstat_count_index_tuples(&scan->xs_pgstat_info, *returned_tids);
return found; return found;
} }

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.93 2005/06/19 22:41:00 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.94 2005/10/06 02:29:12 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -17,6 +17,7 @@
#include "access/genam.h" #include "access/genam.h"
#include "access/nbtree.h" #include "access/nbtree.h"
#include "pgstat.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
@ -501,6 +502,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
int i; int i;
StrategyNumber strat_total; StrategyNumber strat_total;
pgstat_count_index_scan(&scan->xs_pgstat_info);
/* /*
* Examine the scan keys and eliminate any redundant keys; also * Examine the scan keys and eliminate any redundant keys; also
* discover how many keys must be matched to continue the scan. * discover how many keys must be matched to continue the scan.

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/rtree/rtget.c,v 1.35 2005/03/27 23:53:02 tgl Exp $ * $PostgreSQL: pgsql/src/backend/access/rtree/rtget.c,v 1.36 2005/10/06 02:29:14 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -18,6 +18,8 @@
#include "access/iqual.h" #include "access/iqual.h"
#include "access/relscan.h" #include "access/relscan.h"
#include "access/rtree.h" #include "access/rtree.h"
#include "pgstat.h"
static OffsetNumber findnext(IndexScanDesc s, OffsetNumber n, static OffsetNumber findnext(IndexScanDesc s, OffsetNumber n,
ScanDirection dir); ScanDirection dir);
@ -118,6 +120,7 @@ rtnext(IndexScanDesc s, ScanDirection dir)
/* first call: start at the root */ /* first call: start at the root */
Assert(BufferIsValid(so->curbuf) == false); Assert(BufferIsValid(so->curbuf) == false);
so->curbuf = ReadBuffer(s->indexRelation, P_ROOT); so->curbuf = ReadBuffer(s->indexRelation, P_ROOT);
pgstat_count_index_scan(&s->xs_pgstat_info);
} }
p = BufferGetPage(so->curbuf); p = BufferGetPage(so->curbuf);

View File

@ -3,7 +3,7 @@
* *
* Copyright (c) 1996-2005, PostgreSQL Global Development Group * Copyright (c) 1996-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.21 2005/08/15 23:00:13 momjian Exp $ * $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.22 2005/10/06 02:29:15 tgl Exp $
*/ */
CREATE VIEW pg_roles AS CREATE VIEW pg_roles AS
@ -182,8 +182,9 @@ CREATE VIEW pg_stat_all_tables AS
C.relname AS relname, C.relname AS relname,
pg_stat_get_numscans(C.oid) AS seq_scan, pg_stat_get_numscans(C.oid) AS seq_scan,
pg_stat_get_tuples_returned(C.oid) AS seq_tup_read, pg_stat_get_tuples_returned(C.oid) AS seq_tup_read,
sum(pg_stat_get_numscans(I.indexrelid)) AS idx_scan, sum(pg_stat_get_numscans(I.indexrelid))::bigint AS idx_scan,
sum(pg_stat_get_tuples_fetched(I.indexrelid)) AS idx_tup_fetch, sum(pg_stat_get_tuples_fetched(I.indexrelid))::bigint +
pg_stat_get_tuples_fetched(C.oid) AS idx_tup_fetch,
pg_stat_get_tuples_inserted(C.oid) AS n_tup_ins, pg_stat_get_tuples_inserted(C.oid) AS n_tup_ins,
pg_stat_get_tuples_updated(C.oid) AS n_tup_upd, pg_stat_get_tuples_updated(C.oid) AS n_tup_upd,
pg_stat_get_tuples_deleted(C.oid) AS n_tup_del pg_stat_get_tuples_deleted(C.oid) AS n_tup_del
@ -210,8 +211,8 @@ CREATE VIEW pg_statio_all_tables AS
pg_stat_get_blocks_hit(C.oid) AS heap_blks_read, pg_stat_get_blocks_hit(C.oid) AS heap_blks_read,
pg_stat_get_blocks_hit(C.oid) AS heap_blks_hit, pg_stat_get_blocks_hit(C.oid) AS heap_blks_hit,
sum(pg_stat_get_blocks_fetched(I.indexrelid) - sum(pg_stat_get_blocks_fetched(I.indexrelid) -
pg_stat_get_blocks_hit(I.indexrelid)) AS idx_blks_read, pg_stat_get_blocks_hit(I.indexrelid))::bigint AS idx_blks_read,
sum(pg_stat_get_blocks_hit(I.indexrelid)) AS idx_blks_hit, sum(pg_stat_get_blocks_hit(I.indexrelid))::bigint AS idx_blks_hit,
pg_stat_get_blocks_fetched(T.oid) - pg_stat_get_blocks_fetched(T.oid) -
pg_stat_get_blocks_hit(T.oid) AS toast_blks_read, pg_stat_get_blocks_hit(T.oid) AS toast_blks_read,
pg_stat_get_blocks_hit(T.oid) AS toast_blks_hit, pg_stat_get_blocks_hit(T.oid) AS toast_blks_hit,
@ -350,5 +351,5 @@ UPDATE pg_proc SET
'bool'], 'bool'],
proargmodes = ARRAY['i'::"char", 'o', 'o', 'o', 'o', 'o', 'o'], proargmodes = ARRAY['i'::"char", 'o', 'o', 'o', 'o', 'o', 'o'],
proargnames = ARRAY['filename'::text, 'size', 'access', 'modification', proargnames = ARRAY['filename'::text, 'size', 'access', 'modification',
'change', 'creation', 'isdir'] 'change', 'creation', 'isdir']
WHERE oid = 'pg_stat_file(text)'::regprocedure; WHERE oid = 'pg_stat_file(text)'::regprocedure;

View File

@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.2 2005/05/06 17:24:54 tgl Exp $ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.3 2005/10/06 02:29:16 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -39,6 +39,7 @@
#include "executor/execdebug.h" #include "executor/execdebug.h"
#include "executor/nodeBitmapHeapscan.h" #include "executor/nodeBitmapHeapscan.h"
#include "parser/parsetree.h" #include "parser/parsetree.h"
#include "pgstat.h"
#include "utils/memutils.h" #include "utils/memutils.h"
@ -328,6 +329,9 @@ ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt)
/* rescan to release any page pin */ /* rescan to release any page pin */
heap_rescan(node->ss.ss_currentScanDesc, NULL); heap_rescan(node->ss.ss_currentScanDesc, NULL);
/* undo bogus "seq scan" count (see notes in ExecInitBitmapHeapScan) */
pgstat_discount_heap_scan(&node->ss.ss_currentScanDesc->rs_pgstat_info);
if (node->tbm) if (node->tbm)
tbm_free(node->tbm); tbm_free(node->tbm);
node->tbm = NULL; node->tbm = NULL;
@ -475,6 +479,13 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate)
0, 0,
NULL); NULL);
/*
* One problem is that heap_beginscan counts a "sequential scan" start,
* when we actually aren't doing any such thing. Reverse out the added
* scan count. (Eventually we may want to count bitmap scans separately.)
*/
pgstat_discount_heap_scan(&scanstate->ss.ss_currentScanDesc->rs_pgstat_info);
/* /*
* get the scan type from the relation descriptor. * get the scan type from the relation descriptor.
*/ */

View File

@ -13,7 +13,7 @@
* *
* Copyright (c) 2001-2005, PostgreSQL Global Development Group * Copyright (c) 2001-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.108 2005/09/24 17:53:14 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.109 2005/10/06 02:29:17 tgl Exp $
* ---------- * ----------
*/ */
#include "postgres.h" #include "postgres.h"
@ -1159,17 +1159,11 @@ pgstat_initstats(PgStat_Info *stats, Relation rel)
* Initialize data not to count at all. * Initialize data not to count at all.
*/ */
stats->tabentry = NULL; stats->tabentry = NULL;
stats->no_stats = FALSE;
stats->heap_scan_counted = FALSE;
stats->index_scan_counted = FALSE;
if (pgStatSock < 0 || if (pgStatSock < 0 ||
!(pgstat_collect_tuplelevel || !(pgstat_collect_tuplelevel ||
pgstat_collect_blocklevel)) pgstat_collect_blocklevel))
{
stats->no_stats = TRUE;
return; return;
}
tsarr = rel->rd_rel->relisshared ? &SharedTabStat : &RegularTabStat; tsarr = rel->rd_rel->relisshared ? &SharedTabStat : &RegularTabStat;

View File

@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.303 2005/10/02 23:50:11 tgl Exp $ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.304 2005/10/06 02:29:18 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 200510011 #define CATALOG_VERSION_NO 200510051
#endif #endif

View File

@ -5,7 +5,7 @@
* *
* Copyright (c) 2001-2005, PostgreSQL Global Development Group * Copyright (c) 2001-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/include/pgstat.h,v 1.36 2005/08/15 16:25:18 tgl Exp $ * $PostgreSQL: pgsql/src/include/pgstat.h,v 1.37 2005/10/06 02:29:19 tgl Exp $
* ---------- * ----------
*/ */
#ifndef PGSTAT_H #ifndef PGSTAT_H
@ -70,6 +70,13 @@ typedef struct PgStat_MsgHdr
/* ---------- /* ----------
* PgStat_TableEntry Per-table info in a MsgTabstat * PgStat_TableEntry Per-table info in a MsgTabstat
*
* Note: for a table, tuples_returned is the number of tuples successfully
* fetched by heap_getnext, while tuples_fetched is the number of tuples
* successfully fetched by heap_fetch under the control of bitmap indexscans.
* For an index, tuples_returned is the number of index entries returned by
* the index AM, while tuples_fetched is the number of tuples successfully
* fetched by heap_fetch under the control of simple indexscans for this index.
* ---------- * ----------
*/ */
typedef struct PgStat_TableEntry typedef struct PgStat_TableEntry
@ -80,6 +87,7 @@ typedef struct PgStat_TableEntry
PgStat_Counter t_tuples_returned; PgStat_Counter t_tuples_returned;
PgStat_Counter t_tuples_fetched; PgStat_Counter t_tuples_fetched;
PgStat_Counter t_tuples_inserted; PgStat_Counter t_tuples_inserted;
PgStat_Counter t_tuples_updated; PgStat_Counter t_tuples_updated;
PgStat_Counter t_tuples_deleted; PgStat_Counter t_tuples_deleted;
@ -179,8 +187,9 @@ typedef struct PgStat_MsgActivity
* and buffer access statistics. * and buffer access statistics.
* ---------- * ----------
*/ */
#define PGSTAT_NUM_TABENTRIES ((PGSTAT_MSG_PAYLOAD - 3 * sizeof(int)) \ #define PGSTAT_NUM_TABENTRIES \
/ sizeof(PgStat_TableEntry)) ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - 3 * sizeof(int)) \
/ sizeof(PgStat_TableEntry))
typedef struct PgStat_MsgTabstat typedef struct PgStat_MsgTabstat
{ {
@ -197,8 +206,9 @@ typedef struct PgStat_MsgTabstat
* about dead tables. * about dead tables.
* ---------- * ----------
*/ */
#define PGSTAT_NUM_TABPURGE ((PGSTAT_MSG_PAYLOAD - sizeof(int)) \ #define PGSTAT_NUM_TABPURGE \
/ sizeof(Oid)) ((PGSTAT_MSG_PAYLOAD - sizeof(Oid) - sizeof(int)) \
/ sizeof(Oid))
typedef struct PgStat_MsgTabpurge typedef struct PgStat_MsgTabpurge
{ {
@ -211,7 +221,7 @@ typedef struct PgStat_MsgTabpurge
/* ---------- /* ----------
* PgStat_MsgDropdb Sent by the backend to tell the collector * PgStat_MsgDropdb Sent by the backend to tell the collector
* about dropped database * about a dropped database
* ---------- * ----------
*/ */
typedef struct PgStat_MsgDropdb typedef struct PgStat_MsgDropdb
@ -264,7 +274,7 @@ typedef union PgStat_Msg
#define PGSTAT_FILE_FORMAT_ID 0x01A5BC93 #define PGSTAT_FILE_FORMAT_ID 0x01A5BC93
/* ---------- /* ----------
* PgStat_StatDBEntry The collectors data per database * PgStat_StatDBEntry The collector's data per database
* ---------- * ----------
*/ */
typedef struct PgStat_StatDBEntry typedef struct PgStat_StatDBEntry
@ -282,7 +292,7 @@ typedef struct PgStat_StatDBEntry
/* ---------- /* ----------
* PgStat_StatBeEntry The collectors data per backend * PgStat_StatBeEntry The collector's data per backend
* ---------- * ----------
*/ */
typedef struct PgStat_StatBeEntry typedef struct PgStat_StatBeEntry
@ -323,7 +333,7 @@ typedef struct PgStat_StatBeDead
/* ---------- /* ----------
* PgStat_StatTabEntry The collectors data table data * PgStat_StatTabEntry The collector's data per table (or index)
* ---------- * ----------
*/ */
typedef struct PgStat_StatTabEntry typedef struct PgStat_StatTabEntry
@ -334,6 +344,7 @@ typedef struct PgStat_StatTabEntry
PgStat_Counter tuples_returned; PgStat_Counter tuples_returned;
PgStat_Counter tuples_fetched; PgStat_Counter tuples_fetched;
PgStat_Counter tuples_inserted; PgStat_Counter tuples_inserted;
PgStat_Counter tuples_updated; PgStat_Counter tuples_updated;
PgStat_Counter tuples_deleted; PgStat_Counter tuples_deleted;
@ -397,18 +408,16 @@ extern void pgstat_reset_counters(void);
extern void pgstat_initstats(PgStat_Info *stats, Relation rel); extern void pgstat_initstats(PgStat_Info *stats, Relation rel);
#define pgstat_reset_heap_scan(s) \
do { \
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
(s)->heap_scan_counted = FALSE; \
} while (0)
#define pgstat_count_heap_scan(s) \ #define pgstat_count_heap_scan(s) \
do { \ do { \
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL && \ if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
!(s)->heap_scan_counted) { \
((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \
(s)->heap_scan_counted = TRUE; \ } while (0)
} \ /* kluge for bitmap scans: */
#define pgstat_discount_heap_scan(s) \
do { \
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_numscans--; \
} while (0) } while (0)
#define pgstat_count_heap_getnext(s) \ #define pgstat_count_heap_getnext(s) \
do { \ do { \
@ -435,30 +444,22 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel);
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \ if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_deleted++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_deleted++; \
} while (0) } while (0)
#define pgstat_reset_index_scan(s) \
do { \
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
(s)->index_scan_counted = FALSE; \
} while (0)
#define pgstat_count_index_scan(s) \ #define pgstat_count_index_scan(s) \
do { \ do { \
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL && \ if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
!(s)->index_scan_counted) { \
((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_numscans++; \
(s)->index_scan_counted = TRUE; \
} \
} while (0) } while (0)
#define pgstat_count_index_getnext(s) \ #define pgstat_count_index_tuples(s, n) \
do { \ do { \
if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \ if (pgstat_collect_tuplelevel && (s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_tuples_returned += (n); \
} while (0) } while (0)
#define pgstat_count_buffer_read(s,r) \ #define pgstat_count_buffer_read(s,r) \
do { \ do { \
if (pgstat_collect_blocklevel && (s)->tabentry != NULL) \ if (pgstat_collect_blocklevel) { \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \ if ((s)->tabentry != NULL) \
else { \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \
if (pgstat_collect_blocklevel && !(s)->no_stats) { \ else { \
pgstat_initstats((s), (r)); \ pgstat_initstats((s), (r)); \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_fetched++; \
@ -467,10 +468,10 @@ extern void pgstat_initstats(PgStat_Info *stats, Relation rel);
} while (0) } while (0)
#define pgstat_count_buffer_hit(s,r) \ #define pgstat_count_buffer_hit(s,r) \
do { \ do { \
if (pgstat_collect_blocklevel && (s)->tabentry != NULL) \ if (pgstat_collect_blocklevel) { \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \ if ((s)->tabentry != NULL) \
else { \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \
if (pgstat_collect_blocklevel && !(s)->no_stats) { \ else { \
pgstat_initstats((s), (r)); \ pgstat_initstats((s), (r)); \
if ((s)->tabentry != NULL) \ if ((s)->tabentry != NULL) \
((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \ ((PgStat_TableEntry *)((s)->tabentry))->t_blocks_hit++; \

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.85 2005/08/12 01:36:05 tgl Exp $ * $PostgreSQL: pgsql/src/include/utils/rel.h,v 1.86 2005/10/06 02:29:21 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -94,9 +94,6 @@ typedef struct TriggerDesc
typedef struct PgStat_Info typedef struct PgStat_Info
{ {
void *tabentry; void *tabentry;
bool no_stats;
bool heap_scan_counted;
bool index_scan_counted;
} PgStat_Info; } PgStat_Info;

View File

@ -1287,7 +1287,7 @@ SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schem
pg_shadow | SELECT pg_authid.rolname AS usename, pg_authid.oid AS usesysid, pg_authid.rolcreatedb AS usecreatedb, pg_authid.rolsuper AS usesuper, pg_authid.rolcatupdate AS usecatupd, pg_authid.rolpassword AS passwd, (pg_authid.rolvaliduntil)::abstime AS valuntil, pg_authid.rolconfig AS useconfig FROM pg_authid WHERE pg_authid.rolcanlogin; pg_shadow | SELECT pg_authid.rolname AS usename, pg_authid.oid AS usesysid, pg_authid.rolcreatedb AS usecreatedb, pg_authid.rolsuper AS usesuper, pg_authid.rolcatupdate AS usecatupd, pg_authid.rolpassword AS passwd, (pg_authid.rolvaliduntil)::abstime AS valuntil, pg_authid.rolconfig AS useconfig FROM pg_authid WHERE pg_authid.rolcanlogin;
pg_stat_activity | SELECT d.oid AS datid, d.datname, pg_stat_get_backend_pid(s.backendid) AS procpid, pg_stat_get_backend_userid(s.backendid) AS usesysid, u.rolname AS usename, pg_stat_get_backend_activity(s.backendid) AS current_query, pg_stat_get_backend_activity_start(s.backendid) AS query_start, pg_stat_get_backend_start(s.backendid) AS backend_start, pg_stat_get_backend_client_addr(s.backendid) AS client_addr, pg_stat_get_backend_client_port(s.backendid) AS client_port FROM pg_database d, (SELECT pg_stat_get_backend_idset() AS backendid) s, pg_authid u WHERE ((pg_stat_get_backend_dbid(s.backendid) = d.oid) AND (pg_stat_get_backend_userid(s.backendid) = u.oid)); pg_stat_activity | SELECT d.oid AS datid, d.datname, pg_stat_get_backend_pid(s.backendid) AS procpid, pg_stat_get_backend_userid(s.backendid) AS usesysid, u.rolname AS usename, pg_stat_get_backend_activity(s.backendid) AS current_query, pg_stat_get_backend_activity_start(s.backendid) AS query_start, pg_stat_get_backend_start(s.backendid) AS backend_start, pg_stat_get_backend_client_addr(s.backendid) AS client_addr, pg_stat_get_backend_client_port(s.backendid) AS client_port FROM pg_database d, (SELECT pg_stat_get_backend_idset() AS backendid) s, pg_authid u WHERE ((pg_stat_get_backend_dbid(s.backendid) = d.oid) AND (pg_stat_get_backend_userid(s.backendid) = u.oid));
pg_stat_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char")); pg_stat_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, pg_stat_get_numscans(i.oid) AS idx_scan, pg_stat_get_tuples_returned(i.oid) AS idx_tup_read, pg_stat_get_tuples_fetched(i.oid) AS idx_tup_fetch FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char"));
pg_stat_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_numscans(c.oid) AS seq_scan, pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, sum(pg_stat_get_numscans(i.indexrelid)) AS idx_scan, sum(pg_stat_get_tuples_fetched(i.indexrelid)) AS idx_tup_fetch, pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_tuples_deleted(c.oid) AS n_tup_del FROM ((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char")) GROUP BY c.oid, n.nspname, c.relname; pg_stat_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, pg_stat_get_numscans(c.oid) AS seq_scan, pg_stat_get_tuples_returned(c.oid) AS seq_tup_read, (sum(pg_stat_get_numscans(i.indexrelid)))::bigint AS idx_scan, ((sum(pg_stat_get_tuples_fetched(i.indexrelid)))::bigint + pg_stat_get_tuples_fetched(c.oid)) AS idx_tup_fetch, pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, pg_stat_get_tuples_deleted(c.oid) AS n_tup_del FROM ((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char")) GROUP BY c.oid, n.nspname, c.relname;
pg_stat_database | SELECT d.oid AS datid, d.datname, pg_stat_get_db_numbackends(d.oid) AS numbackends, pg_stat_get_db_xact_commit(d.oid) AS xact_commit, pg_stat_get_db_xact_rollback(d.oid) AS xact_rollback, (pg_stat_get_db_blocks_fetched(d.oid) - pg_stat_get_db_blocks_hit(d.oid)) AS blks_read, pg_stat_get_db_blocks_hit(d.oid) AS blks_hit FROM pg_database d; pg_stat_database | SELECT d.oid AS datid, d.datname, pg_stat_get_db_numbackends(d.oid) AS numbackends, pg_stat_get_db_xact_commit(d.oid) AS xact_commit, pg_stat_get_db_xact_rollback(d.oid) AS xact_rollback, (pg_stat_get_db_blocks_fetched(d.oid) - pg_stat_get_db_blocks_hit(d.oid)) AS blks_read, pg_stat_get_db_blocks_hit(d.oid) AS blks_hit FROM pg_database d;
pg_stat_sys_indexes | SELECT pg_stat_all_indexes.relid, pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.schemaname, pg_stat_all_indexes.relname, pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_fetch FROM pg_stat_all_indexes WHERE (((pg_stat_all_indexes.schemaname = 'pg_catalog'::name) OR (pg_stat_all_indexes.schemaname = 'pg_toast'::name)) OR (pg_stat_all_indexes.schemaname = 'information_schema'::name)); pg_stat_sys_indexes | SELECT pg_stat_all_indexes.relid, pg_stat_all_indexes.indexrelid, pg_stat_all_indexes.schemaname, pg_stat_all_indexes.relname, pg_stat_all_indexes.indexrelname, pg_stat_all_indexes.idx_scan, pg_stat_all_indexes.idx_tup_read, pg_stat_all_indexes.idx_tup_fetch FROM pg_stat_all_indexes WHERE (((pg_stat_all_indexes.schemaname = 'pg_catalog'::name) OR (pg_stat_all_indexes.schemaname = 'pg_toast'::name)) OR (pg_stat_all_indexes.schemaname = 'information_schema'::name));
pg_stat_sys_tables | SELECT pg_stat_all_tables.relid, pg_stat_all_tables.schemaname, pg_stat_all_tables.relname, pg_stat_all_tables.seq_scan, pg_stat_all_tables.seq_tup_read, pg_stat_all_tables.idx_scan, pg_stat_all_tables.idx_tup_fetch, pg_stat_all_tables.n_tup_ins, pg_stat_all_tables.n_tup_upd, pg_stat_all_tables.n_tup_del FROM pg_stat_all_tables WHERE (((pg_stat_all_tables.schemaname = 'pg_catalog'::name) OR (pg_stat_all_tables.schemaname = 'pg_toast'::name)) OR (pg_stat_all_tables.schemaname = 'information_schema'::name)); pg_stat_sys_tables | SELECT pg_stat_all_tables.relid, pg_stat_all_tables.schemaname, pg_stat_all_tables.relname, pg_stat_all_tables.seq_scan, pg_stat_all_tables.seq_tup_read, pg_stat_all_tables.idx_scan, pg_stat_all_tables.idx_tup_fetch, pg_stat_all_tables.n_tup_ins, pg_stat_all_tables.n_tup_upd, pg_stat_all_tables.n_tup_del FROM pg_stat_all_tables WHERE (((pg_stat_all_tables.schemaname = 'pg_catalog'::name) OR (pg_stat_all_tables.schemaname = 'pg_toast'::name)) OR (pg_stat_all_tables.schemaname = 'information_schema'::name));
@ -1295,7 +1295,7 @@ SELECT viewname, definition FROM pg_views WHERE schemaname <> 'information_schem
pg_stat_user_tables | SELECT pg_stat_all_tables.relid, pg_stat_all_tables.schemaname, pg_stat_all_tables.relname, pg_stat_all_tables.seq_scan, pg_stat_all_tables.seq_tup_read, pg_stat_all_tables.idx_scan, pg_stat_all_tables.idx_tup_fetch, pg_stat_all_tables.n_tup_ins, pg_stat_all_tables.n_tup_upd, pg_stat_all_tables.n_tup_del FROM pg_stat_all_tables WHERE (((pg_stat_all_tables.schemaname <> 'pg_catalog'::name) AND (pg_stat_all_tables.schemaname <> 'pg_toast'::name)) AND (pg_stat_all_tables.schemaname <> 'information_schema'::name)); pg_stat_user_tables | SELECT pg_stat_all_tables.relid, pg_stat_all_tables.schemaname, pg_stat_all_tables.relname, pg_stat_all_tables.seq_scan, pg_stat_all_tables.seq_tup_read, pg_stat_all_tables.idx_scan, pg_stat_all_tables.idx_tup_fetch, pg_stat_all_tables.n_tup_ins, pg_stat_all_tables.n_tup_upd, pg_stat_all_tables.n_tup_del FROM pg_stat_all_tables WHERE (((pg_stat_all_tables.schemaname <> 'pg_catalog'::name) AND (pg_stat_all_tables.schemaname <> 'pg_toast'::name)) AND (pg_stat_all_tables.schemaname <> 'information_schema'::name));
pg_statio_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, (pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid)) AS idx_blks_read, pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char")); pg_statio_all_indexes | SELECT c.oid AS relid, i.oid AS indexrelid, n.nspname AS schemaname, c.relname, i.relname AS indexrelname, (pg_stat_get_blocks_fetched(i.oid) - pg_stat_get_blocks_hit(i.oid)) AS idx_blks_read, pg_stat_get_blocks_hit(i.oid) AS idx_blks_hit FROM (((pg_class c JOIN pg_index x ON ((c.oid = x.indrelid))) JOIN pg_class i ON ((i.oid = x.indexrelid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char"));
pg_statio_all_sequences | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS blks_read, pg_stat_get_blocks_hit(c.oid) AS blks_hit FROM (pg_class c LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = 'S'::"char"); pg_statio_all_sequences | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS blks_read, pg_stat_get_blocks_hit(c.oid) AS blks_hit FROM (pg_class c LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE (c.relkind = 'S'::"char");
pg_statio_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, sum((pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))) AS idx_blks_read, sum(pg_stat_get_blocks_hit(i.indexrelid)) AS idx_blks_hit, (pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid)) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, (pg_stat_get_blocks_fetched(x.oid) - pg_stat_get_blocks_hit(x.oid)) AS tidx_blks_read, pg_stat_get_blocks_hit(x.oid) AS tidx_blks_hit FROM ((((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_class t ON ((c.reltoastrelid = t.oid))) LEFT JOIN pg_class x ON ((t.reltoastidxid = x.oid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char")) GROUP BY c.oid, n.nspname, c.relname, t.oid, x.oid; pg_statio_all_tables | SELECT c.oid AS relid, n.nspname AS schemaname, c.relname, (pg_stat_get_blocks_fetched(c.oid) - pg_stat_get_blocks_hit(c.oid)) AS heap_blks_read, pg_stat_get_blocks_hit(c.oid) AS heap_blks_hit, (sum((pg_stat_get_blocks_fetched(i.indexrelid) - pg_stat_get_blocks_hit(i.indexrelid))))::bigint AS idx_blks_read, (sum(pg_stat_get_blocks_hit(i.indexrelid)))::bigint AS idx_blks_hit, (pg_stat_get_blocks_fetched(t.oid) - pg_stat_get_blocks_hit(t.oid)) AS toast_blks_read, pg_stat_get_blocks_hit(t.oid) AS toast_blks_hit, (pg_stat_get_blocks_fetched(x.oid) - pg_stat_get_blocks_hit(x.oid)) AS tidx_blks_read, pg_stat_get_blocks_hit(x.oid) AS tidx_blks_hit FROM ((((pg_class c LEFT JOIN pg_index i ON ((c.oid = i.indrelid))) LEFT JOIN pg_class t ON ((c.reltoastrelid = t.oid))) LEFT JOIN pg_class x ON ((t.reltoastidxid = x.oid))) LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 't'::"char")) GROUP BY c.oid, n.nspname, c.relname, t.oid, x.oid;
pg_statio_sys_indexes | SELECT pg_statio_all_indexes.relid, pg_statio_all_indexes.indexrelid, pg_statio_all_indexes.schemaname, pg_statio_all_indexes.relname, pg_statio_all_indexes.indexrelname, pg_statio_all_indexes.idx_blks_read, pg_statio_all_indexes.idx_blks_hit FROM pg_statio_all_indexes WHERE (((pg_statio_all_indexes.schemaname = 'pg_catalog'::name) OR (pg_statio_all_indexes.schemaname = 'pg_toast'::name)) OR (pg_statio_all_indexes.schemaname = 'information_schema'::name)); pg_statio_sys_indexes | SELECT pg_statio_all_indexes.relid, pg_statio_all_indexes.indexrelid, pg_statio_all_indexes.schemaname, pg_statio_all_indexes.relname, pg_statio_all_indexes.indexrelname, pg_statio_all_indexes.idx_blks_read, pg_statio_all_indexes.idx_blks_hit FROM pg_statio_all_indexes WHERE (((pg_statio_all_indexes.schemaname = 'pg_catalog'::name) OR (pg_statio_all_indexes.schemaname = 'pg_toast'::name)) OR (pg_statio_all_indexes.schemaname = 'information_schema'::name));
pg_statio_sys_sequences | SELECT pg_statio_all_sequences.relid, pg_statio_all_sequences.schemaname, pg_statio_all_sequences.relname, pg_statio_all_sequences.blks_read, pg_statio_all_sequences.blks_hit FROM pg_statio_all_sequences WHERE (((pg_statio_all_sequences.schemaname = 'pg_catalog'::name) OR (pg_statio_all_sequences.schemaname = 'pg_toast'::name)) OR (pg_statio_all_sequences.schemaname = 'information_schema'::name)); pg_statio_sys_sequences | SELECT pg_statio_all_sequences.relid, pg_statio_all_sequences.schemaname, pg_statio_all_sequences.relname, pg_statio_all_sequences.blks_read, pg_statio_all_sequences.blks_hit FROM pg_statio_all_sequences WHERE (((pg_statio_all_sequences.schemaname = 'pg_catalog'::name) OR (pg_statio_all_sequences.schemaname = 'pg_toast'::name)) OR (pg_statio_all_sequences.schemaname = 'information_schema'::name));
pg_statio_sys_tables | SELECT pg_statio_all_tables.relid, pg_statio_all_tables.schemaname, pg_statio_all_tables.relname, pg_statio_all_tables.heap_blks_read, pg_statio_all_tables.heap_blks_hit, pg_statio_all_tables.idx_blks_read, pg_statio_all_tables.idx_blks_hit, pg_statio_all_tables.toast_blks_read, pg_statio_all_tables.toast_blks_hit, pg_statio_all_tables.tidx_blks_read, pg_statio_all_tables.tidx_blks_hit FROM pg_statio_all_tables WHERE (((pg_statio_all_tables.schemaname = 'pg_catalog'::name) OR (pg_statio_all_tables.schemaname = 'pg_toast'::name)) OR (pg_statio_all_tables.schemaname = 'information_schema'::name)); pg_statio_sys_tables | SELECT pg_statio_all_tables.relid, pg_statio_all_tables.schemaname, pg_statio_all_tables.relname, pg_statio_all_tables.heap_blks_read, pg_statio_all_tables.heap_blks_hit, pg_statio_all_tables.idx_blks_read, pg_statio_all_tables.idx_blks_hit, pg_statio_all_tables.toast_blks_read, pg_statio_all_tables.toast_blks_hit, pg_statio_all_tables.tidx_blks_read, pg_statio_all_tables.tidx_blks_hit FROM pg_statio_all_tables WHERE (((pg_statio_all_tables.schemaname = 'pg_catalog'::name) OR (pg_statio_all_tables.schemaname = 'pg_toast'::name)) OR (pg_statio_all_tables.schemaname = 'information_schema'::name));

View File

@ -11,8 +11,6 @@ SHOW stats_start_collector; -- must be on
on on
(1 row) (1 row)
-- XXX stopgap until we figure out how bitmap scans should be counted
SET enable_bitmapscan = off;
-- save counters -- save counters
CREATE TEMP TABLE prevstats AS CREATE TEMP TABLE prevstats AS
SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch, SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,

View File

@ -8,9 +8,6 @@
-- conditio sine qua non -- conditio sine qua non
SHOW stats_start_collector; -- must be on SHOW stats_start_collector; -- must be on
-- XXX stopgap until we figure out how bitmap scans should be counted
SET enable_bitmapscan = off;
-- save counters -- save counters
CREATE TEMP TABLE prevstats AS CREATE TEMP TABLE prevstats AS
SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch, SELECT t.seq_scan, t.seq_tup_read, t.idx_scan, t.idx_tup_fetch,