Re: How do a user-defined function that returns a table executes a query?

Поиск
Список
Период
Сортировка
От Laurenz Albe
Тема Re: How do a user-defined function that returns a table executes a query?
Дата
Msg-id dc3596ca4e75b29f8ee74a4fa218c2ad4c6ced2e.camel@cybertec.at
обсуждение исходный текст
Ответ на How do a user-defined function that returns a table executes a query?  (Katsuya Okizaki <miotsukushi0800@gmail.com>)
Ответы Re: How do a user-defined function that returns a table executes a query?  (Katsuya Okizaki <miotsukushi0800@gmail.com>)
Список pgsql-general
On Wed, 2023-02-08 at 08:49 +0900, Katsuya Okizaki wrote:
> In a normal SQL, we can use the EXPLAIN command to view the execution plan.
> However, in this case, I am not sure how a user-defined function work.
>
> If anyone has faced a similar situation and found a way to view the execution plan,
> I would greatly appreciate your insights and suggestions.

I am not sure which of the following you want:

1. Get the execution plan of SQL statements run inside a function:

   For that, you would use "auto_explain" with "auto_explain.log_nested_statements = on".

2. Get a trace of the execution of the function code itself:

   For PL/pgSQL, there is "pldebugger" (https://github.com/EnterpriseDB/pldebugger),
   which can be used together with pgAdmin.

   I usually sprinkle the code with RAISE NOTICE statements.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com



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

Предыдущее
От: veem v
Дата:
Сообщение: Re: Sequence vs UUID
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Switching identity column to serial