1 <!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.64 2009/03/10 00:08:28 momjian Exp $ -->
3 <chapter id="monitoring">
4 <title>Monitoring Database Activity</title>
6 <indexterm zone="monitoring">
7 <primary>monitoring</primary>
8 <secondary>database activity</secondary>
11 <indexterm zone="monitoring">
12 <primary>database activity</primary>
13 <secondary>monitoring</secondary>
17 A database administrator frequently wonders, <quote>What is the system
18 doing right now?</quote>
19 This chapter discusses how to find that out.
23 Several tools are available for monitoring database activity and
24 analyzing performance. Most of this chapter is devoted to describing
25 <productname>PostgreSQL</productname>'s statistics collector,
26 but one should not neglect regular Unix monitoring programs such as
27 <command>ps</>, <command>top</>, <command>iostat</>, and <command>vmstat</>.
28 Also, once one has identified a
29 poorly-performing query, further investigation might be needed using
30 <productname>PostgreSQL</productname>'s <xref linkend="sql-explain"
31 endterm="sql-explain-title"> command.
32 <xref linkend="using-explain"> discusses <command>EXPLAIN</>
33 and other methods for understanding the behavior of an individual
37 <sect1 id="monitoring-ps">
38 <title>Standard Unix Tools</Title>
40 <indexterm zone="monitoring-ps">
42 <secondary>to monitor activity</secondary>
46 On most platforms, <productname>PostgreSQL</productname> modifies its
47 command title as reported by <command>ps</>, so that individual server
48 processes can readily be identified. A sample display is
51 $ ps auxww | grep ^postgres
52 postgres 960 0.0 1.1 6104 1480 pts/1 SN 13:17 0:00 postgres -i
53 postgres 963 0.0 1.1 7084 1472 pts/1 SN 13:17 0:00 postgres: writer process
54 postgres 965 0.0 1.1 6152 1512 pts/1 SN 13:17 0:00 postgres: stats collector process
55 postgres 998 0.0 2.3 6532 2992 pts/1 SN 13:18 0:00 postgres: tgl runbug 127.0.0.1 idle
56 postgres 1003 0.0 2.4 6532 3128 pts/1 SN 13:19 0:00 postgres: tgl regression [local] SELECT waiting
57 postgres 1016 0.1 2.4 6532 3080 pts/1 SN 13:19 0:00 postgres: tgl regression [local] idle in transaction
60 (The appropriate invocation of <command>ps</> varies across different
61 platforms, as do the details of what is shown. This example is from a
62 recent Linux system.) The first process listed here is the
63 master server process. The command arguments
64 shown for it are the same ones given when it was launched. The next two
65 processes are background worker processes automatically launched by the
66 master process. (The <quote>stats collector</> process will not be present
68 the system not to start the statistics collector.) Each of the remaining
69 processes is a server process handling one client connection. Each such
70 process sets its command line display in the form
73 postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <replaceable>activity</>
76 The user, database, and connection source host items remain the same for
77 the life of the client connection, but the activity indicator changes.
78 The activity can be <literal>idle</> (i.e., waiting for a client command),
79 <literal>idle in transaction</> (waiting for client inside a <command>BEGIN</> block),
80 or a command type name such as <literal>SELECT</>. Also,
81 <literal>waiting</> is attached if the server process is presently waiting
82 on a lock held by another server process. In the above example we can infer
83 that process 1003 is waiting for process 1016 to complete its transaction and
84 thereby release some lock or other.
88 If you have turned off <xref linkend="guc-update-process-title"> then the
89 activity indicator is not updated; the process title is set only once
90 when a new process is launched. On some platforms this saves a useful
91 amount of per-command overhead, on others it's insignificant.
96 <productname>Solaris</productname> requires special handling. You must
97 use <command>/usr/ucb/ps</command>, rather than
98 <command>/bin/ps</command>. You also must use two <option>w</option>
99 flags, not just one. In addition, your original invocation of the
100 <command>postgres</command> command must have a shorter
101 <command>ps</command> status display than that provided by each
102 server process. If you fail to do all three things, the <command>ps</>
103 output for each server process will be the original <command>postgres</>
109 <sect1 id="monitoring-stats">
110 <title>The Statistics Collector</Title>
112 <indexterm zone="monitoring-stats">
113 <primary>statistics</primary>
117 <productname>PostgreSQL</productname>'s <firstterm>statistics collector</>
118 is a subsystem that supports collection and reporting of information about
119 server activity. Presently, the collector can count accesses to tables
120 and indexes in both disk-block and individual-row terms. It also tracks
121 total numbers of rows in each table, and the last vacuum and analyze times
122 for each table. It can also count calls to user-defined functions and
123 the total time spent in each one.
127 <productname>PostgreSQL</productname> also supports determining the exact
128 command currently being executed by other server processes. This is an
129 independent facility that does not depend on the collector process.
132 <sect2 id="monitoring-stats-setup">
133 <title>Statistics Collection Configuration</Title>
136 Since collection of statistics adds some overhead to query execution,
137 the system can be configured to collect or not collect information.
138 This is controlled by configuration parameters that are normally set in
139 <filename>postgresql.conf</>. (See <xref linkend="runtime-config"> for
140 details about setting configuration parameters.)
144 The parameter <xref linkend="guc-track-counts"> controls whether
145 statistics are collected about table and index accesses.
149 The parameter <xref linkend="guc-track-functions"> enables tracking of
150 usage of user-defined functions.
154 The parameter <xref linkend="guc-track-activities"> enables monitoring
155 of the current command being executed by any server process.
159 Normally these parameters are set in <filename>postgresql.conf</> so
160 that they apply to all server processes, but it is possible to turn
161 them on or off in individual sessions using the <xref
162 linkend="sql-set" endterm="sql-set-title"> command. (To prevent
163 ordinary users from hiding their activity from the administrator,
164 only superusers are allowed to change these parameters with
169 The statistics collector communicates with the backends needing
170 information (including autovacuum) through temporary files.
171 These files are stored in the <filename>pg_stat_tmp</filename> subdirectory.
172 When the postmaster shuts down, a permanent copy of the statistics
173 data is stored in the <filename>global</filename> subdirectory. For increased
174 performance, the parameter <xref linkend="guc-stats-temp-directory"> can
175 be pointed at a RAM based filesystem, decreasing physical I/O requirements.
180 <sect2 id="monitoring-stats-views">
181 <title>Viewing Collected Statistics</Title>
184 Several predefined views, listed in <xref
185 linkend="monitoring-stats-views-table">, are available to show the results
186 of statistics collection. Alternatively, one can
187 build custom views using the underlying statistics functions.
191 When using the statistics to monitor current activity, it is important
192 to realize that the information does not update instantaneously.
193 Each individual server process transmits new statistical counts to
194 the collector just before going idle; so a query or transaction still in
195 progress does not affect the displayed totals. Also, the collector itself
196 emits a new report at most once per <varname>PGSTAT_STAT_INTERVAL</varname>
197 milliseconds (500 unless altered while building the server). So the
198 displayed information lags behind actual activity. However, current-query
199 information collected by <varname>track_activities</varname> is
204 Another important point is that when a server process is asked to display
205 any of these statistics, it first fetches the most recent report emitted by
206 the collector process and then continues to use this snapshot for all
207 statistical views and functions until the end of its current transaction.
208 So the statistics will appear not to change as long as you continue the
209 current transaction. Similarly, information about the current queries of
210 all processes is collected when any such information is first requested
211 within a transaction, and the same information will be displayed throughout
213 This is a feature, not a bug, because it allows you to perform several
214 queries on the statistics and correlate the results without worrying that
215 the numbers are changing underneath you. But if you want to see new
216 results with each query, be sure to do the queries outside any transaction
217 block. Alternatively, you can invoke
218 <function>pg_stat_clear_snapshot</function>(), which will discard the
219 current transaction's statistics snapshot (if any). The next use of
220 statistical information will cause a new snapshot to be fetched.
223 <table id="monitoring-stats-views-table">
224 <title>Standard Statistics Views</title>
229 <entry>View Name</entry>
230 <entry>Description</entry>
236 <entry><structname>pg_stat_activity</></entry>
237 <entry>One row per server process, showing database OID, database
238 name, process <acronym>ID</>, user OID, user name, current query,
239 query's waiting status, time at which the current transaction and
240 current query began execution, time at which the process was
241 started, and client's address and port number. The columns that
242 report data on the current query are available unless the parameter
243 <varname>track_activities</varname> has been turned off.
244 Furthermore, these columns are only visible if the user examining
245 the view is a superuser or the same as the user owning the process
251 <entry><structname>pg_stat_bgwriter</></entry>
252 <entry>One row only, showing cluster-wide statistics from the
253 background writer: number of scheduled checkpoints, requested
254 checkpoints, buffers written by checkpoints and cleaning scans,
255 and the number of times the background writer stopped a cleaning scan
256 because it had written too many buffers. Also includes
257 statistics about the shared buffer pool, including buffers written
258 by backends (that is, not by the background writer) and total buffers
264 <entry><structname>pg_stat_database</></entry>
265 <entry>One row per database, showing database OID, database name,
266 number of active server processes connected to that database,
267 number of transactions committed and rolled back in that database,
268 total disk blocks read, total buffer hits (i.e., block
269 read requests avoided by finding the block already in buffer cache),
270 number of rows returned, fetched, inserted, updated and deleted.
275 <entry><structname>pg_stat_all_tables</></entry>
276 <entry>For each table in the current database (including TOAST tables),
277 the table OID, schema and table name, number of sequential
278 scans initiated, number of live rows fetched by sequential
279 scans, number of index scans initiated (over all indexes
280 belonging to the table), number of live rows fetched by index
281 scans, numbers of row insertions, updates, and deletions,
282 number of row updates that were HOT (i.e., no separate index update),
283 numbers of live and dead rows,
284 the last time the table was vacuumed manually,
285 the last time it was vacuumed by the autovacuum daemon,
286 the last time it was analyzed manually,
287 and the last time it was analyzed by the autovacuum daemon.
292 <entry><structname>pg_stat_sys_tables</></entry>
293 <entry>Same as <structname>pg_stat_all_tables</>, except that only
294 system tables are shown.</entry>
298 <entry><structname>pg_stat_user_tables</></entry>
299 <entry>Same as <structname>pg_stat_all_tables</>, except that only user
300 tables are shown.</entry>
304 <entry><structname>pg_stat_all_indexes</></entry>
305 <entry>For each index in the current database,
306 the table and index OID, schema, table and index name,
307 number of index scans initiated on that index, number of
308 index entries returned by index scans, and number of live table rows
309 fetched by simple index scans using that index.
314 <entry><structname>pg_stat_sys_indexes</></entry>
315 <entry>Same as <structname>pg_stat_all_indexes</>, except that only
316 indexes on system tables are shown.</entry>
320 <entry><structname>pg_stat_user_indexes</></entry>
321 <entry>Same as <structname>pg_stat_all_indexes</>, except that only
322 indexes on user tables are shown.</entry>
326 <entry><structname>pg_statio_all_tables</></entry>
327 <entry>For each table in the current database (including TOAST tables),
328 the table OID, schema and table name, number of disk
329 blocks read from that table, number of buffer hits, numbers of
330 disk blocks read and buffer hits in all indexes of that table,
331 numbers of disk blocks read and buffer hits from that table's
332 auxiliary TOAST table (if any), and numbers of disk blocks read
333 and buffer hits for the TOAST table's index.
338 <entry><structname>pg_statio_sys_tables</></entry>
339 <entry>Same as <structname>pg_statio_all_tables</>, except that only
340 system tables are shown.</entry>
344 <entry><structname>pg_statio_user_tables</></entry>
345 <entry>Same as <structname>pg_statio_all_tables</>, except that only
346 user tables are shown.</entry>
350 <entry><structname>pg_statio_all_indexes</></entry>
351 <entry>For each index in the current database,
352 the table and index OID, schema, table and index name,
353 numbers of disk blocks read and buffer hits in that index.
358 <entry><structname>pg_statio_sys_indexes</></entry>
359 <entry>Same as <structname>pg_statio_all_indexes</>, except that only
360 indexes on system tables are shown.</entry>
364 <entry><structname>pg_statio_user_indexes</></entry>
365 <entry>Same as <structname>pg_statio_all_indexes</>, except that only
366 indexes on user tables are shown.</entry>
370 <entry><structname>pg_statio_all_sequences</></entry>
371 <entry>For each sequence object in the current database,
372 the sequence OID, schema and sequence name,
373 numbers of disk blocks read and buffer hits in that sequence.
378 <entry><structname>pg_statio_sys_sequences</></entry>
379 <entry>Same as <structname>pg_statio_all_sequences</>, except that only
380 system sequences are shown. (Presently, no system sequences are defined,
381 so this view is always empty.)</entry>
385 <entry><structname>pg_statio_user_sequences</></entry>
386 <entry>Same as <structname>pg_statio_all_sequences</>, except that only
387 user sequences are shown.</entry>
391 <entry><structname>pg_stat_user_functions</></entry>
392 <entry>For all tracked functions, function OID, schema, name, number
393 of calls, total time, and self time. Self time is the
394 amount of time spent in the function itself, total time includes the
395 time spent in functions it called. Time values are in milliseconds.
404 The per-index statistics are particularly useful to determine which
405 indexes are being used and how effective they are.
409 Beginning in <productname>PostgreSQL</productname> 8.1, indexes can be
410 used either directly or via <quote>bitmap scans</>. In a bitmap scan
411 the output of several indexes can be combined via AND or OR rules;
412 so it is difficult to associate individual heap row fetches
413 with specific indexes when a bitmap scan is used. Therefore, a bitmap
415 <structname>pg_stat_all_indexes</>.<structfield>idx_tup_read</>
416 count(s) for the index(es) it uses, and it increments the
417 <structname>pg_stat_all_tables</>.<structfield>idx_tup_fetch</>
418 count for the table, but it does not affect
419 <structname>pg_stat_all_indexes</>.<structfield>idx_tup_fetch</>.
424 Before <productname>PostgreSQL</productname> 8.1, the
425 <structfield>idx_tup_read</> and <structfield>idx_tup_fetch</> counts
426 were essentially always equal. Now they can be different even without
427 considering bitmap scans, because <structfield>idx_tup_read</> counts
428 index entries retrieved from the index while <structfield>idx_tup_fetch</>
429 counts live rows fetched from the table; the latter will be less if any
430 dead or not-yet-committed rows are fetched using the index.
435 The <structname>pg_statio_</> views are primarily useful to
436 determine the effectiveness of the buffer cache. When the number
437 of actual disk reads is much smaller than the number of buffer
438 hits, then the cache is satisfying most read requests without
439 invoking a kernel call. However, these statistics do not give the
440 entire story: due to the way in which <productname>PostgreSQL</>
441 handles disk I/O, data that is not in the
442 <productname>PostgreSQL</> buffer cache might still reside in the
443 kernel's I/O cache, and might therefore still be fetched without
444 requiring a physical read. Users interested in obtaining more
445 detailed information on <productname>PostgreSQL</> I/O behavior are
446 advised to use the <productname>PostgreSQL</> statistics collector
447 in combination with operating system utilities that allow insight
448 into the kernel's handling of I/O.
452 Other ways of looking at the statistics can be set up by writing
453 queries that use the same underlying statistics access functions as
454 these standard views do. These functions are listed in <xref
455 linkend="monitoring-stats-funcs-table">. The per-database access
456 functions take a database OID as argument to identify which
457 database to report on. The per-table and per-index functions take
458 a table or index OID. The functions for function-call statistics
459 take a function OID. (Note that only tables, indexes, and functions
460 in the current database can be seen with these functions.) The
461 per-server-process access functions take a server process
462 number, which ranges from one to the number of currently active
466 <table id="monitoring-stats-funcs-table">
467 <title>Statistics Access Functions</title>
472 <entry>Function</entry>
473 <entry>Return Type</entry>
474 <entry>Description</entry>
480 <entry><literal><function>pg_stat_get_db_numbackends</function>(<type>oid</type>)</literal></entry>
481 <entry><type>integer</type></entry>
483 Number of active server processes for database
488 <entry><literal><function>pg_stat_get_db_xact_commit</function>(<type>oid</type>)</literal></entry>
489 <entry><type>bigint</type></entry>
491 Transactions committed in database
496 <entry><literal><function>pg_stat_get_db_xact_rollback</function>(<type>oid</type>)</literal></entry>
497 <entry><type>bigint</type></entry>
499 Transactions rolled back in database
504 <entry><literal><function>pg_stat_get_db_blocks_fetched</function>(<type>oid</type>)</literal></entry>
505 <entry><type>bigint</type></entry>
507 Number of disk block fetch requests for database
512 <entry><literal><function>pg_stat_get_db_blocks_hit</function>(<type>oid</type>)</literal></entry>
513 <entry><type>bigint</type></entry>
515 Number of disk block fetch requests found in cache for database
520 <entry><literal><function>pg_stat_get_db_tuples_returned</function>(<type>oid</type>)</literal></entry>
521 <entry><type>bigint</type></entry>
523 Number of tuples returned for database
528 <entry><literal><function>pg_stat_get_db_tuples_fetched</function>(<type>oid</type>)</literal></entry>
529 <entry><type>bigint</type></entry>
531 Number of tuples fetched for database
536 <entry><literal><function>pg_stat_get_db_tuples_inserted</function>(<type>oid</type>)</literal></entry>
537 <entry><type>bigint</type></entry>
539 Number of tuples inserted in database
544 <entry><literal><function>pg_stat_get_db_tuples_updated</function>(<type>oid</type>)</literal></entry>
545 <entry><type>bigint</type></entry>
547 Number of tuples updated in database
552 <entry><literal><function>pg_stat_get_db_tuples_deleted</function>(<type>oid</type>)</literal></entry>
553 <entry><type>bigint</type></entry>
555 Number of tuples deleted in database
560 <entry><literal><function>pg_stat_get_numscans</function>(<type>oid</type>)</literal></entry>
561 <entry><type>bigint</type></entry>
563 Number of sequential scans done when argument is a table,
564 or number of index scans done when argument is an index
569 <entry><literal><function>pg_stat_get_tuples_returned</function>(<type>oid</type>)</literal></entry>
570 <entry><type>bigint</type></entry>
572 Number of rows read by sequential scans when argument is a table,
573 or number of index entries returned when argument is an index
578 <entry><literal><function>pg_stat_get_tuples_fetched</function>(<type>oid</type>)</literal></entry>
579 <entry><type>bigint</type></entry>
581 Number of table rows fetched by bitmap scans when argument is a table,
582 or table rows fetched by simple index scans using the index
583 when argument is an index
588 <entry><literal><function>pg_stat_get_tuples_inserted</function>(<type>oid</type>)</literal></entry>
589 <entry><type>bigint</type></entry>
591 Number of rows inserted into table
596 <entry><literal><function>pg_stat_get_tuples_updated</function>(<type>oid</type>)</literal></entry>
597 <entry><type>bigint</type></entry>
599 Number of rows updated in table (includes HOT updates)
604 <entry><literal><function>pg_stat_get_tuples_deleted</function>(<type>oid</type>)</literal></entry>
605 <entry><type>bigint</type></entry>
607 Number of rows deleted from table
612 <entry><literal><function>pg_stat_get_tuples_hot_updated</function>(<type>oid</type>)</literal></entry>
613 <entry><type>bigint</type></entry>
615 Number of rows HOT-updated in table
620 <entry><literal><function>pg_stat_get_live_tuples</function>(<type>oid</type>)</literal></entry>
621 <entry><type>bigint</type></entry>
623 Number of live rows in table
628 <entry><literal><function>pg_stat_get_dead_tuples</function>(<type>oid</type>)</literal></entry>
629 <entry><type>bigint</type></entry>
631 Number of dead rows in table
636 <entry><literal><function>pg_stat_get_blocks_fetched</function>(<type>oid</type>)</literal></entry>
637 <entry><type>bigint</type></entry>
639 Number of disk block fetch requests for table or index
644 <entry><literal><function>pg_stat_get_blocks_hit</function>(<type>oid</type>)</literal></entry>
645 <entry><type>bigint</type></entry>
647 Number of disk block requests found in cache for table or index
652 <entry><literal><function>pg_stat_get_last_vacuum_time</function>(<type>oid</type>)</literal></entry>
653 <entry><type>timestamptz</type></entry>
655 Time of the last vacuum initiated by the user on this table
660 <entry><literal><function>pg_stat_get_last_autovacuum_time</function>(<type>oid</type>)</literal></entry>
661 <entry><type>timestamptz</type></entry>
663 Time of the last vacuum initiated by the autovacuum daemon on this table
668 <entry><literal><function>pg_stat_get_last_analyze_time</function>(<type>oid</type>)</literal></entry>
669 <entry><type>timestamptz</type></entry>
671 Time of the last analyze initiated by the user on this table
676 <entry><literal><function>pg_stat_get_last_autoanalyze_time</function>(<type>oid</type>)</literal></entry>
677 <entry><type>timestamptz</type></entry>
679 Time of the last analyze initiated by the autovacuum daemon on this
685 <!-- See also the entry for this in func.sgml -->
686 <entry><literal><function>pg_backend_pid</function>()</literal></entry>
687 <entry><type>integer</type></entry>
689 Process ID of the server process attached to the current session
694 <entry><literal><function>pg_stat_get_activity</function>(<type>integer</type>)</literal></entry>
695 <entry><type>setof record</type></entry>
697 Returns a record of information about the backend with the specified pid, or
698 one record for each active backend in the system if <symbol>NULL</symbol> is
699 specified. The fields returned are the same as in the
700 <structname>pg_stat_activity</structname> view
705 <entry><literal><function>pg_stat_get_function_calls</function>(<type>oid</type>)</literal></entry>
706 <entry><type>bigint</type></entry>
708 Number of times the function has been called.
713 <entry><literal><function>pg_stat_get_function_time</function>(<type>oid</type>)</literal></entry>
714 <entry><type>bigint</type></entry>
716 Total wall clock time spent in the function, in microseconds. Includes
717 the time spent in functions called by this one.
722 <entry><literal><function>pg_stat_get_function_self_time</function>(<type>oid</type>)</literal></entry>
723 <entry><type>bigint</type></entry>
725 Time spent in only this function. Time spent in called functions
731 <entry><literal><function>pg_stat_get_backend_idset</function>()</literal></entry>
732 <entry><type>setof integer</type></entry>
734 Set of currently active server process numbers (from 1 to the
735 number of active server processes). See usage example in the text
740 <entry><literal><function>pg_stat_get_backend_pid</function>(<type>integer</type>)</literal></entry>
741 <entry><type>integer</type></entry>
743 Process ID of the given server process
748 <entry><literal><function>pg_stat_get_backend_dbid</function>(<type>integer</type>)</literal></entry>
749 <entry><type>oid</type></entry>
751 Database ID of the given server process
756 <entry><literal><function>pg_stat_get_backend_userid</function>(<type>integer</type>)</literal></entry>
757 <entry><type>oid</type></entry>
759 User ID of the given server process
764 <entry><literal><function>pg_stat_get_backend_activity</function>(<type>integer</type>)</literal></entry>
765 <entry><type>text</type></entry>
767 Active command of the given server process, but only if the
768 current user is a superuser or the same user as that of
769 the session being queried (and
770 <varname>track_activities</varname> is on)
775 <entry><literal><function>pg_stat_get_backend_waiting</function>(<type>integer</type>)</literal></entry>
776 <entry><type>boolean</type></entry>
778 True if the given server process is waiting for a lock,
779 but only if the current user is a superuser or the same user as that of
780 the session being queried (and
781 <varname>track_activities</varname> is on)
786 <entry><literal><function>pg_stat_get_backend_activity_start</function>(<type>integer</type>)</literal></entry>
787 <entry><type>timestamp with time zone</type></entry>
789 The time at which the given server process' currently
790 executing query was started, but only if the
791 current user is a superuser or the same user as that of
792 the session being queried (and
793 <varname>track_activities</varname> is on)
798 <entry><literal><function>pg_stat_get_backend_xact_start</function>(<type>integer</type>)</literal></entry>
799 <entry><type>timestamp with time zone</type></entry>
801 The time at which the given server process' currently
802 executing transaction was started, but only if the
803 current user is a superuser or the same user as that of
804 the session being queried (and
805 <varname>track_activities</varname> is on)
810 <entry><literal><function>pg_stat_get_backend_start</function>(<type>integer</type>)</literal></entry>
811 <entry><type>timestamp with time zone</type></entry>
813 The time at which the given server process was started, or
814 null if the current user is not a superuser nor the same user
815 as that of the session being queried
820 <entry><literal><function>pg_stat_get_backend_client_addr</function>(<type>integer</type>)</literal></entry>
821 <entry><type>inet</type></entry>
823 The IP address of the client connected to the given
824 server process. Null if the connection is over a Unix domain
825 socket. Also null if the current user is not a superuser nor
826 the same user as that of the session being queried
831 <entry><literal><function>pg_stat_get_backend_client_port</function>(<type>integer</type>)</literal></entry>
832 <entry><type>integer</type></entry>
834 The IP port number of the client connected to the given
835 server process. -1 if the connection is over a Unix domain
836 socket. Null if the current user is not a superuser nor the
837 same user as that of the session being queried
842 <entry><literal><function>pg_stat_get_bgwriter_timed_checkpoints</function>()</literal></entry>
843 <entry><type>bigint</type></entry>
845 The number of times the background writer has started timed checkpoints
846 (because the <varname>checkpoint_timeout</varname> time has expired)
851 <entry><literal><function>pg_stat_get_bgwriter_requested_checkpoints</function>()</literal></entry>
852 <entry><type>bigint</type></entry>
854 The number of times the background writer has started checkpoints based
855 on requests from backends because the <varname>checkpoint_segments</varname>
856 has been exceeded or because the <command>CHECKPOINT</command>
857 command has been issued
862 <entry><literal><function>pg_stat_get_bgwriter_buf_written_checkpoints</function>()</literal></entry>
863 <entry><type>bigint</type></entry>
865 The number of buffers written by the background writer during checkpoints
870 <entry><literal><function>pg_stat_get_bgwriter_buf_written_clean</function>()</literal></entry>
871 <entry><type>bigint</type></entry>
873 The number of buffers written by the background writer for routine cleaning of
879 <entry><literal><function>pg_stat_get_bgwriter_maxwritten_clean</function>()</literal></entry>
880 <entry><type>bigint</type></entry>
882 The number of times the background writer has stopped its cleaning scan because
883 it has written more buffers than specified in the
884 <varname>bgwriter_lru_maxpages</varname> parameter
889 <entry><literal><function>pg_stat_get_buf_written_backend</function>()</literal></entry>
890 <entry><type>bigint</type></entry>
892 The number of buffers written by backends because they needed
893 to allocate a new buffer
898 <entry><literal><function>pg_stat_get_buf_alloc</function>()</literal></entry>
899 <entry><type>bigint</type></entry>
901 The total number of buffer allocations
906 <entry><literal><function>pg_stat_clear_snapshot</function>()</literal></entry>
907 <entry><type>void</type></entry>
909 Discard the current statistics snapshot
914 <entry><literal><function>pg_stat_reset</function>()</literal></entry>
915 <entry><type>void</type></entry>
917 Reset all statistics counters for the current database to zero
918 (requires superuser privileges)
927 <function>blocks_fetched</function> minus
928 <function>blocks_hit</function> gives the number of kernel
929 <function>read()</> calls issued for the table, index, or
930 database; but the actual number of physical reads is usually
931 lower due to kernel-level buffering.
936 All functions to access information about backends are indexed by backend id
937 number, except <function>pg_stat_get_activity</function> which is indexed by PID.
938 The function <function>pg_stat_get_backend_idset</function> provides
939 a convenient way to generate one row for each active server process. For
940 example, to show the <acronym>PID</>s and current queries of all server processes:
943 SELECT pg_stat_get_backend_pid(s.backendid) AS procpid,
944 pg_stat_get_backend_activity(s.backendid) AS current_query
945 FROM (SELECT pg_stat_get_backend_idset() AS backendid) AS s;
952 <sect1 id="monitoring-locks">
953 <title>Viewing Locks</title>
955 <indexterm zone="monitoring-locks">
956 <primary>lock</primary>
957 <secondary>monitoring</secondary>
961 Another useful tool for monitoring database activity is the
962 <structname>pg_locks</structname> system table. It allows the
963 database administrator to view information about the outstanding
964 locks in the lock manager. For example, this capability can be used
970 View all the locks currently outstanding, all the locks on
971 relations in a particular database, all the locks on a
972 particular relation, or all the locks held by a particular
973 <productname>PostgreSQL</productname> session.
979 Determine the relation in the current database with the most
980 ungranted locks (which might be a source of contention among
987 Determine the effect of lock contention on overall database
988 performance, as well as the extent to which contention varies
989 with overall database traffic.
994 Details of the <structname>pg_locks</structname> view appear in
995 <xref linkend="view-pg-locks">.
996 For more information on locking and managing concurrency with
997 <productname>PostgreSQL</productname>, refer to <xref linkend="mvcc">.
1001 <sect1 id="dynamic-trace">
1002 <title>Dynamic Tracing</title>
1004 <indexterm zone="dynamic-trace">
1005 <primary>DTrace</primary>
1009 <productname>PostgreSQL</productname> provides facilities to support
1010 dynamic tracing of the database server. This allows an external
1011 utility to be called at specific points in the code and thereby trace
1016 A number of probes or trace points are already inserted into the source
1017 code. These probes are intended to be used by database developers and
1018 administrators. By default the probes are not compiled into the
1019 binary, and the user needs to explicitly tell the configure script to make
1020 the probes available in <productname>PostgreSQL</productname>.
1025 <ulink url="http://opensolaris.org/os/community/dtrace/">DTrace</ulink>
1026 utility is supported, which is available
1027 on OpenSolaris, Solaris 10, and Mac OS X Leopard. It is expected that
1028 DTrace will be available in the future on FreeBSD and possibly other
1029 operating systems. Supporting other dynamic tracing utilities is
1030 theoretically possible by changing the definitions for the macros in
1031 <filename>src/include/utils/probes.h</>.
1034 <sect2 id="compiling-for-trace">
1035 <title>Compiling for Dynamic Tracing</title>
1038 By default, probes are not available, so you will need to
1039 explicitly tell the configure script to make the probes available
1040 in <productname>PostgreSQL</productname>. To include DTrace support
1041 specify <option>--enable-dtrace</> to configure. See <xref
1042 linkend="install-procedure"> for further information.
1046 <sect2 id="trace-points">
1047 <title>Built-in Probes</title>
1050 A number of standard probes are provided in the source code, and more
1051 can certainly be added to enhance PostgreSQL's observability. There are two categories
1052 of probes, those that are targeted toward database administrators and those for developers.
1053 They are shown in <xref linkend="admin-trace-point-table"> and
1054 <xref linkend="dev-trace-point-table">.
1057 <table id="admin-trace-point-table">
1058 <title>Built-in Probes for Administrators</title>
1063 <entry>Parameters</entry>
1064 <entry>Description</entry>
1071 <entry>transaction-start</entry>
1072 <entry>(LocalTransactionId)</entry>
1073 <entry>Probe that fires at the start of a new transaction. arg0 is the transaction id.</entry>
1076 <entry>transaction-commit</entry>
1077 <entry>(LocalTransactionId)</entry>
1078 <entry>Probe that fires when a transaction completes successfully. arg0 is the transaction id.</entry>
1081 <entry>transaction-abort</entry>
1082 <entry>(LocalTransactionId)</entry>
1083 <entry>Probes that fires when a transaction does not complete successfully. arg0 is the transaction id.</entry>
1086 <entry>query-start</entry>
1087 <entry>(const char *)</entry>
1088 <entry>Probe that fires when the execution of a statement is started. arg0 is the query string.</entry>
1091 <entry>query-done</entry>
1092 <entry>(const char *)</entry>
1093 <entry>Probe that fires when the execution of a statement is complete. arg0 is the query string.</entry>
1096 <entry>query-parse-start</entry>
1097 <entry>(const char *)</entry>
1098 <entry>Probe that fires when the parsing of a query is started. arg0 is the query string.</entry>
1101 <entry>query-parse-done</entry>
1102 <entry>(const char *)</entry>
1103 <entry>Probe that fires when the parsing of a query is complete. arg0 is the query string.</entry>
1106 <entry>query-rewrite-start</entry>
1107 <entry>(const char *)</entry>
1108 <entry>Probe that fires when the rewriting of a query is started. arg0 is the query string.</entry>
1111 <entry>query-rewrite-done</entry>
1112 <entry>(const char *)</entry>
1113 <entry>Probe that fires when the rewriting of a query is complete. arg0 is the query string.</entry>
1116 <entry>query-plan-start</entry>
1118 <entry>Probe that fires when the planning of a query is started.</entry>
1121 <entry>query-plan-done</entry>
1123 <entry>Probe that fires when the planning of a query is complete.</entry>
1126 <entry>query-execute-start</entry>
1128 <entry>Probe that fires when the execution of a query is started.</entry>
1131 <entry>query-execute-done</entry>
1133 <entry>Probe that fires when the execution of a query is complete.</entry>
1136 <entry>statement-status</entry>
1137 <entry>(const char *)</entry>
1138 <entry>Probe that fires anytime an SQL statement is executed on the server. arg0 is the query string.</entry>
1141 <entry>checkpoint-start</entry>
1142 <entry>(int)</entry>
1143 <entry>Probe that fires when a checkpoint is performed. arg0 holds the bitwise flags used to distinguish different checkpoints such as shutdown, immediate or force.</entry>
1146 <entry>checkpoint-done</entry>
1147 <entry>(int, int, int, int, int)</entry>
1148 <entry>Probe that fires when a checkpoint is complete. arg0 is the number of buffers written. arg1 is the total number of buffers. arg2, arg3 and arg4 contain the number of xlog file(s) added, removed and recycled respectively.</entry>
1151 <entry>clog-checkpoint-start</entry>
1152 <entry>(bool)</entry>
1153 <entry>Probe that fires when the CLOG portion of the checkpoint is started. arg0 is either true or false, true for normal checkpoint, false for postmaster shutdown.</entry>
1156 <entry>clog-checkpoint-done</entry>
1157 <entry>(bool)</entry>
1158 <entry>Probe that fires when the CLOG portion of the checkpoint is complete. arg0 has the same meaning as clog-checkpoint-start.</entry>
1161 <entry>subtrans-checkpoint-start</entry>
1162 <entry>(bool)</entry>
1163 <entry>Probe that fires when the SUBTRANS portion of the checkpoint is started. arg0 is either true or false, true for normal checkpoint, false for postmaster shutdown.</entry>
1166 <entry>subtrans-checkpoint-done</entry>
1167 <entry>(bool)</entry>
1168 <entry>Probe that fires when the SUBTRANS portion of the checkpoint is complete. arg0 has the same meaning as subtrans-checkpoint-done.</entry>
1171 <entry>multixact-checkpoint-start</entry>
1172 <entry>(bool)</entry>
1173 <entry>Probe that fires when the MultiXact portion of the checkpoint is started. arg0 is either true or false, true for normal checkpoint, false for postmaster shutdown.</entry>
1176 <entry>multixact-checkpoint-done</entry>
1177 <entry>(bool)</entry>
1178 <entry>Probe that fires when the MultiXact portion of the checkpoint is complete. arg0 has the same meaning as multixact-checkpoint-start.</entry>
1181 <entry>buffer-checkpoint-start</entry>
1182 <entry>(int)</entry>
1183 <entry>Probe that fires when the shared buffers portion of the checkpoint is started to flush out the buffers, and it's always followed by buffer-sync-start. arg0 holds the bitwise flags used to distinguish different checkpoints such as shutdown, immediate or force</entry>
1186 <entry>buffer-checkpoint-sync-start</entry>
1188 <entry>Probe that fires to fsync buffers to disk, and it's always preceeded by buffer-checkpoint-start, buffer-sync-start, and buffer-flush-start. The time difference between buffer-checkpoint-start and buffer-checkpoint-sync-start is the write time, and the difference between buffer-checkpoint-sync-start and buffer-checkpoint-done is the sync time.</entry>
1191 <entry>buffer-checkpoint-done</entry>
1193 <entry>Probe that fires when the shared buffers portion of the checkpoint is complete. This probe is fired after buffer-checkpoint-sync-start.</entry>
1196 <entry>twophase-checkpoint-start</entry>
1198 <entry>Probe that fires when the two-phase portion of the checkpoint is started.</entry>
1201 <entry>twophase-checkpoint-done</entry>
1203 <entry>Probe that fires when the two-phase portion of the checkpoint is complete.</entry>
1206 <entry>buffer-hit</entry>
1207 <entry>(bool)</entry>
1208 <entry>Probe that fires when a read request is satisfied from the buffer cache. arg0 is either true or false, true for local buffer, false for shared buffer.</entry>
1211 <entry>buffer-miss</entry>
1212 <entry>(bool)</entry>
1213 <entry>Probe that fires when a read request requires disk access. arg0 is either true or false, true for local buffer, false for shared buffer .</entry>
1216 <entry>buffer-read-start</entry>
1217 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, bool)</entry>
1218 <entry>Probe that fires when a buffer read is started. arg0 and arg1 contain the fork and block numbers. arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs respectively. arg5 is either true or false, true for local buffer, false for shared buffer.</entry>
1221 <entry>buffer-read-done</entry>
1222 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, bool, bool)</entry>
1223 <entry>Probe that fires when a buffer read is complete. arg0 and arg1 contain the fork and block numbers. arg2, arg3, and arg4 contain the tablespace, database, and relation OIDs respectively. arg5 is either true or false, true for local buffer, false for shared buffer. arg6 is true if buffer is found in the pool, false otherwise.</entry>
1226 <entry>buffer-sync-start</entry>
1227 <entry>(int, int)</entry>
1228 <entry>Probe that fires to write out all dirty buffers in the pool at checkpoint time, and it's always preceeded by buffer-checkpoint-start and followed by buffer-flush-start. arg0 is the total number of buffers. arg1 is the number it intends to write.</entry>
1231 <entry>buffer-sync-done</entry>
1232 <entry>(int, int, int)</entry>
1233 <entry>Probe that fires when all dirty buffers have been written. arg0 is the total number of buffers. arg1 is the number actually written. arg2 is the total number to write.</entry>
1236 <entry>buffer-sync-written</entry>
1237 <entry>(int)</entry>
1238 <entry>Probe that fires when the buffer pool syncing is in progress (e.g. buffer-sync-start has fired) and a buffer has been successfully written.</entry>
1241 <entry>buffer-flush-start</entry>
1242 <entry>(Oid, Oid, Oid)</entry>
1243 <entry>Probe that fires when a shared buffer needs to be physically written out to disk, and it's always preceeded by buffer-sync-start. This actually just passes the buffer contents to the kernel; the real write to disk happens later by the kernel. This is okay since the changes have already been written to the WAL. arg0, arg1, and arg2 contain the tablespace, database, and relation OIDs respectively.</entry>
1246 <entry>buffer-flush-done</entry>
1247 <entry>(Oid, Oid, Oid)</entry>
1248 <entry>Probe that fires when the buffer flush is complete, and it's always followed by buffer-checkpoint-sync-start. arg0, arg1, and arg2 have the same meaning as buffer-flush-start.</entry>
1251 <entry>buffer-write-dirty-start</entry>
1252 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
1253 <entry>Probe that fires when the server starts writting out dirty buffers, indicating that the bgwriter is ineffective or shared_buffers is too small. arg0 refers to a fork in a relation. arg1 is the disk block number. arg2, arg3, arg4 contain the tablespace, database, and relation OIDs respectively.</entry>
1256 <entry>buffer-write-dirty-done</entry>
1257 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
1258 <entry>Probe that fires when the buffer write is complete. The arguments are the same as buffer-write-dirty-start probe.</entry>
1261 <entry>wal-buffer-write-dirty-start</entry>
1263 <entry>Probe that fires when the server starts writting out dirty WAL buffers, indicating that no more WAL buffer pages are available. Increasing wal_buffers will reduce the writes and may improve performance.</entry>
1266 <entry>wal-buffer-write-dirty-done</entry>
1268 <entry>Probe that fires when the WAL buffer write is complete.</entry>
1271 <entry>xlog-insert</entry>
1272 <entry>(unsigned char, unsigned char)</entry>
1273 <entry>Probe that fires when data is inserted in the XLog. arg0 is the resource manager (rmid) for the record. arg1 represents the info flags.</entry>
1276 <entry>xlog-switch</entry>
1278 <entry>Probe that fires when an XLog switch is requested. This is always immediately preceeded by an firing of the xlog-insert probe.</entry>
1281 <entry>sort-start</entry>
1282 <entry>(int, bool, int, int, bool)</entry>
1283 <entry>Probe that fires when sort is performed. arg0 indicates heap, index or datum sort. arg1 is true for unique enforcement. arg2 is the number of keys. arg3 represents workMem. arg3 is true for random access.</entry>
1286 <entry>sort-done</entry>
1287 <entry>(unsigned long, long)</entry>
1288 <entry>Probe that fires when sort is complete. arg0 is either true or false, true for external sort, false for internal sort. arg1 is the number of disk blocks used for external sort or memory used in KB for internal sort.</entry>
1291 <entry>smgr-md-read-start</entry>
1292 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
1293 <entry>Probes that fires when reading a block from a relation. arg0 and arg1 contain fork and block number. arg2, arg3 and arg4 contain the tablespace, database and relation OIDs.</entry>
1296 <entry>smgr-md-read-done</entry>
1297 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, const char *, int, int)</entry>
1298 <entry>Probes that fires when a block read is complete. arg0 and arg1 contan fork and block number. arg2, arg3, arg4 contain the tablespace, database, and relation OIDs. arg5 is the path to the relation's file. arg6 is the number of bytes read. arg7 is the block size.</entry>
1301 <entry>smgr-md-write-start</entry>
1302 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid)</entry>
1303 <entry>Probes that fires when writing a block to the appropriate relation. arg0 and arg1 contain fork and block number. arg2, arg3 and arg4 contain the tablespace, database and relation OIDs.</entry>
1306 <entry>smgr-md-write-done</entry>
1307 <entry>(ForkNumber, BlockNumber, Oid, Oid, Oid, const char *, int, int)</entry>
1308 <entry>Probes that fires when a block write is complete. arg0 and arg1 contan fork and block number. arg2, arg3, arg4 contain the tablespace, database, and relation OIDs. arg5 is the path to the relation's file. arg6 is number of bytes read. arg7 is the block size.</entry>
1311 <entry>deadlock-found</entry>
1313 <entry>Probe that fires when a deadlock is found by the deadlock detector.</entry>
1322 <table id="dev-trace-point-table">
1323 <title>Built-in Probes for Developers</title>
1328 <entry>Parameters</entry>
1329 <entry>Description</entry>
1336 <entry>lwlock-acquire</entry>
1337 <entry>(LWLockId, LWLockMode)</entry>
1338 <entry>Probe that fires when an LWLock has been acquired. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
1341 <entry>lwlock-release</entry>
1342 <entry>(LWLockId)</entry>
1343 <entry>Probe that fires when an LWLock has been released. arg0 is a predefined or dynamic ID defined in LWLockId enum.</entry>
1346 <entry>lwlock-wait-start</entry>
1347 <entry>(LWLockId, LWLockMode)</entry>
1348 <entry>Probe that fires when an LWLock was not immediately available and a backend has begun to wait for the lock to become available. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared .</entry>
1351 <entry>lwlock-wait-done</entry>
1352 <entry>(LWLockId, LWLockMode)</entry>
1353 <entry>Probe that fires when a backend has been released from its wait for an LWLock. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
1356 <entry>lwlock-condacquire</entry>
1357 <entry>(LWLockId, LWLockMode)</entry>
1358 <entry>Probe that fires when an LWLock was successfully acquired when the caller specified no waiting. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
1361 <entry>lwlock-condacquire-fail</entry>
1362 <entry>(LWLockId, LWLockMode)</entry>
1363 <entry>Probe that fires when an LWLock was not successfully acquired when the caller specified no waiting. arg0 is a predefined or dynamic ID defined in LWLockId enum. arg1 is a lock mode, either exclusive or shared.</entry>
1366 <entry>lock-wait-start</entry>
1367 <entry>(unsigned int, LOCKMODE)</entry>
1368 <entry>Probe that fires when a request for a heavyweight lock (lmgr lock) has begun to wait because the lock is not available. arg0 is the unique ID tag defined in LOCKTAG struct. arg1 is an integer indicating a lock type.
1372 <entry>lock-wait-done</entry>
1373 <entry>(unsigned int, LOCKMODE)</entry>
1374 <entry>Probe that fires when a request for a heavyweight lock (lmgr lock) has finished waiting (i.e., has acquired the lock). arg0 is the unique ID tag defined in LOCKTAG struct. arg1 is an integer indicating a lock type.
1381 <table id="typedefs-table">
1382 <title>Defined Types Used in Probe Parameters</title>
1387 <entry>Definition</entry>
1394 <entry>LocalTransactionId</entry>
1395 <entry>unsigned int</entry>
1398 <entry>LWLockId</entry>
1402 <entry>LWLockMode</entry>
1406 <entry>LOCKMODE</entry>
1410 <entry>BlockNumber</entry>
1411 <entry>unsigned int</entry>
1415 <entry>unsigned int</entry>
1418 <entry>ForkNumber</entry>
1433 <sect2 id="using-trace-points">
1434 <title>Using Probes</title>
1437 The example below shows a DTrace script for analyzing transaction
1438 counts on the system, as an alternative to snapshotting
1439 <structname>pg_stat_database</> before and after a performance test:
1441 #!/usr/sbin/dtrace -qs
1443 postgresql$1:::transaction-start
1445 @start["Start"] = count();
1446 self->ts = timestamp;
1449 postgresql$1:::transaction-abort
1451 @abort["Abort"] = count();
1454 postgresql$1:::transaction-commit
1457 @commit["Commit"] = count();
1458 @time["Total time (ns)"] = sum(timestamp - self->ts);
1462 When executed, the example D script gives output such as:
1464 # ./txn_count.d `pgrep -n postgres` or ./txn_count.d <PID>
1469 Total time (ns) 2312105013
1473 You should remember that DTrace scripts need to be carefully written and
1474 debugged prior to their use, otherwise the trace information collected might
1475 be meaningless. In most cases where problems are found it is the
1476 instrumentation that is at fault, not the underlying system. When
1477 discussing information found using dynamic tracing, be sure to enclose
1478 the script used to allow that too to be checked and discussed.
1481 More example scripts can be found on
1482 <ulink url="http://pgfoundry.org/projects/dtrace/">PgFoundry.</ulink>
1486 <sect2 id="defining-trace-points">
1487 <title>Defining New Probes</title>
1490 New probes can be defined within the code wherever the developer
1491 desires, though this will require a recompilation. Below are the steps
1492 for inserting new probes:
1498 Decide on probe names and data to be made available through the probes
1504 Add the probe definitions to <filename>src/backend/utils/probes.d</>
1510 Include pg_trace.h if it is not already presence and insert a one-line probe macros at the desired locations in the source code
1516 Recompile and verify that the new probes are available
1522 <title>Example:</title>
1524 Here is an example of how you would add a probe to trace all new transactions by transaction ID.
1531 Name the probe transaction-start and give it a parameter of type LocalTransactionId
1537 Add <quote>probe transaction__start(LocalTransactionId);</quote> to
1538 <filename>src/backend/utils/probes.d</>, and it should look like the following:
1540 provider postgresql {
1542 probe transaction__start(LocalTransactionId);
1546 Note the use of the double underline in the probe name. In the DTrace
1547 script, the double underline needs to be replaced with a hyphen.
1551 You should take care that the data types specified for the probe
1552 parameters match the data types of the variables used in the macro.
1553 Otherwise, you will get compilation errors.
1559 At compile time, transaction__start is converted to a macro called
1560 TRACE_POSTGRESQL_TRANSACTION_START, and it resides in
1561 <filename>src/backend/utils/probes.h</>. Before recompiling, add
1562 the single line macro to the appropriate location in the source code.
1563 In this case, it looks like the following:
1569 StartTransaction(void)
1574 * Advertise it in the proc array. We assume assignment of
1575 * LocalTransactionID is atomic, and the backendId should be set already.
1577 Assert(MyProc->backendId == vxid.backendId);
1578 MyProc->lxid = vxid.localTransactionId;
1580 TRACE_POSTGRESQL_TRANSACTION_START(vxid.localTransactionId);
1585 Note how the transaction ID is made available to the dynamic tracing
1592 After recompiling and running the new binary, check that your newly added
1593 probe is available by executing the following DTrace command, and you
1594 should see similar output.
1596 # dtrace -ln transaction-start
1597 ID PROVIDER MODULE FUNCTION NAME
1598 18705 postgresql49878 postgres StartTransactionCommand transaction-start
1599 18755 postgresql49877 postgres StartTransactionCommand transaction-start
1600 18805 postgresql49876 postgres StartTransactionCommand transaction-start
1601 18855 postgresql49875 postgres StartTransactionCommand transaction-start
1602 18986 postgresql49873 postgres StartTransactionCommand transaction-start