From: | Marcelo Fernandes <marcefern7(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Logging queries executed by SPI_execute |
Date: | 2025-02-04 04:08:48 |
Message-ID: | CAM2F1VPz8qw2S-ND1xHWqaDw+wZ6cpeXErsONYCJLob=mc_Rqg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Feb 3, 2025 at 6:46 PM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> The queries executed by SPI are never executed on the top level. These queries are marked as nested.
>
> So you need to use auto_explain https://www.postgresql.org/docs/current/auto-explain.html with active auto_explain.log_nested_statements
Thanks Pavel, I have tried that but however couldn't succeed.
I have added this to my postgres.conf file:
session_preload_libraries = 'auto_explain'
auto_explain.log_nested_statements = true
After running pg_repack, which calls SPI_execute* functions, I can't really see
those functions being propagated to the logs.
I have a workaround in place, which is to add elog calls such as
elog(LOG, "...")
to capture the queries. But of course, ideally a postgres.conf setting would be
more handy.
Best,
Marcelo
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2025-02-04 05:06:55 | Re: Logging queries executed by SPI_execute |
Previous Message | Andrey Borodin | 2025-02-03 19:15:02 | Re: Using Expanded Objects other than Arrays from plpgsql |