Search Postgresql Archives

Re: Logging queries executed by SPI_execute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





út 4. 2. 2025 v 5:09 odesílatel Marcelo Fernandes <marcefern7@xxxxxxxxx> napsal:
On Mon, Feb 3, 2025 at 6:46 PM Pavel Stehule <pavel.stehule@xxxxxxxxx> 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

you are missing setting  auto_explain.log_min_duration

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux