index 1b05a31faf6b1a549b10da04efa90223f4d21bed..8323bd6a89d70f9fe3d484d634ef7b14c10ed547 100644 (file)
</informaltable>
The <literal>%c</> escape prints a quasi-unique session identifier,
- consisting of two hexadecimal numbers separated by a dot. The numbers
- are the process start time and the
+ consisting of two 4-byte hexadecimal numbers separated by a dot.
+ The numbers are the process start time and the
process ID, so <literal>%c</> can also be used as a space saving way
of printing those items. For example, to generate the session
identifier from <literal>pg_stat_activity</>, use this query:
<programlisting>
SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
- to_hex(pid)
+ regexp_replace('0000' || to_hex(pid), '^0*(.*....)$', '1円')
FROM pg_stat_activity;
</programlisting>