implement query_start for pg_stat_activity

Поиск
Список
Период
Сортировка
От Neil Conway
Тема implement query_start for pg_stat_activity
Дата
Msg-id 1045632433.583.368.camel@tokyo
обсуждение исходный текст
Ответы Re: implement query_start for pg_stat_activity  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: implement query_start for pg_stat_activity  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
This patch implements the TODO item

    - Add start time to pg_stat_activity

The implementation is straight-forward, except for two issues:

(1) The natural name for the backend function is
pg_stat_get_backend_activity_start(), which at 34 exceeds the
NAMEDATALEN limitation in previous releases of PostgreSQL. While that
limit has been raised, it seems a shame to me to not allow users to
manual lower it again -- so I renamed the function to
pg_stat_get_backend_qry_start(), and renamed the existing function that
fetches the query string from pg_stat_get_backend_activity() to
pg_stat_get_backend_qry() for consistency. If someone thinks that's the
wrong decision, let me know.

(2) I wasn't sure how to convert a struct timeval into a PostgreSQL
timestamp type, so I hacked something together involving ctime() and
timestamp_in(), but it seems clearly wrong. Can someone suggest how to
do this properly?

Cheers,

Neil

PS: Shouldn't the pg_stat_get_backend_xxx() functions be marked
"volatile"? (They're currently marked "stable")
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC



Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: more doc improvements
Следующее
От: Tom Lane
Дата:
Сообщение: Re: implement query_start for pg_stat_activity