public inbox for [email protected]
help / color / mirror / Atom feedLogging queries executed by SPI_execute
2+ messages / 2 participants
[nested] [flat]
* Logging queries executed by SPI_execute
@ 2025-02-02 23:05 Marcelo Fernandes <[email protected]>
2025-02-03 05:45 ` Re: Logging queries executed by SPI_execute Pavel Stehule <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Fernandes @ 2025-02-02 23:05 UTC (permalink / raw)
To: [email protected]
Hi there,
I have been trying to debug what queries an extension is firing. After reading
the code for the extension, I noticed that all the statements are fired via the
SPI interface, most specifically, using the SPI_execute* family of functions.
However, the problem is that these statements don't seem to feature in the
logfile. It has become a bit of a "dead end" for me to fully analyse what
queries are fired in the end.
My postgresql.conf is fairly simple, but I have added "log_statement = 'all'"
and thus was expecting to see information for these statements too.
Is there anything I am missing? Some configuration or perhaps another way to
find out about these statements?
It may not be relevant, but the extension I am having a look at is pg_repack if
anyone is interested. I am trying to get a deeper understanding of what the
function repack_apply does.
Thanks,
Marcelo.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Logging queries executed by SPI_execute
2025-02-02 23:05 Logging queries executed by SPI_execute Marcelo Fernandes <[email protected]>
@ 2025-02-03 05:45 ` Pavel Stehule <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Stehule @ 2025-02-03 05:45 UTC (permalink / raw)
To: Marcelo Fernandes <[email protected]>; +Cc: [email protected]
Hi
po 3. 2. 2025 v 0:06 odesÃlatel Marcelo Fernandes <[email protected]>
napsal:
> Hi there,
>
> I have been trying to debug what queries an extension is firing. After
> reading
> the code for the extension, I noticed that all the statements are fired
> via the
> SPI interface, most specifically, using the SPI_execute* family of
> functions.
>
> However, the problem is that these statements don't seem to feature in the
> logfile. It has become a bit of a "dead end" for me to fully analyse what
> queries are fired in the end.
>
> My postgresql.conf is fairly simple, but I have added "log_statement =
> 'all'"
> and thus was expecting to see information for these statements too.
>
> Is there anything I am missing? Some configuration or perhaps another way
> to
> find out about these statements?
>
> It may not be relevant, but the extension I am having a look at is
> pg_repack if
> anyone is interested. I am trying to get a deeper understanding of what the
> function repack_apply does.
>
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
Regards
Pavel
> Thanks,
> Marcelo.
>
>
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-02-03 05:45 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-02 23:05 Logging queries executed by SPI_execute Marcelo Fernandes <[email protected]>
2025-02-03 05:45 ` Pavel Stehule <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox