| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | OMPRAKASH SAHU <sahuop2121(at)gmail(dot)com> |
| Cc: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: performance issue with a PL/pgSQL function |
| Date: | 2026-04-15 05:19:41 |
| Message-ID: | 1931205.1776230381@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
OMPRAKASH SAHU <sahuop2121(at)gmail(dot)com> writes:
> I am using a temp table name 5 to 6 times, by storing the data temporarily
> and handing over to other temp and then drop & create temp_table with same
> name to store next temporary data,
That's definitely an anti-pattern. Can you TRUNCATE the temp table
instead of drop-n-recreate?
> Seeing the query plan just by running explain is hectic in case of
> function having more than 4k lines of code, can you please help me if
> there is any tool to check the whole execution plan for a function just
> like we get for a select query.
There's no "whole execution plan" for a function, only for individual
queries within it. You might find auto_explain (with
log_nested_statements turned on) to be useful to capture those query
plans.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mahendra Singh | 2026-04-15 07:05:59 | Update postgresql via offline mode |
| Previous Message | OMPRAKASH SAHU | 2026-04-15 02:59:46 | Re: performance issue with a PL/pgSQL function |