Re: proposal: psql: psql variable BACKEND_PID

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: proposal: psql: psql variable BACKEND_PID
Дата
Msg-id 20230213175829.bw6accj563em6e35@awork3.anarazel.de
обсуждение исходный текст
Ответ на Re: proposal: psql: psql variable BACKEND_PID  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2023-02-13 12:52:23 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > E.g. I fire of a query, it's slower than I'd like, I want to attach perf. Of
> > course I can establish a separate connection, query pg_stat_activity there,
> > and then perf. But that requires manually filtering pg_stat_activity to find
> > the query.
> 
> ... in this case, the problem is that the session is tied up doing the
> slow query.  You can't run "select pg_backend_pid()", but you can't
> extract a psql variable value either.  If you had the foresight to
> set up a PROMPT, or to collect the PID earlier, you're good.  But I'm
> still not seeing where a psql variable makes that easier.

I guess you could argue that referencing BACKEND_PID in PROMPT would be more
readable. But that's about it.

Greetings,

Andres Freund



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: proposal: psql: psql variable BACKEND_PID
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Rework LogicalOutputPluginWriterUpdateProgress