pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedProfiling a function...
2+ messages / 2 participants
[nested] [flat]
* Profiling a function...
@ 2005-01-21 16:57 Robert Sanford <rsanford@trefs.com>
2005-01-21 17:20 ` Re: Profiling a function... Richard Huxton <dev@archonet.com>
0 siblings, 1 reply; 2+ messages in thread
From: Robert Sanford @ 2005-01-21 16:57 UTC (permalink / raw)
To: pgsql-performance
How do I profile a user-defined function so that I know which parts of the
function are the ones that are taking the biggest chunk of time?
When I run EXPLAIN on the queries within the function none of them show up
as onerous burdens to the performance. But when they are all operating
together within the function and within the functional logic they become
really expensive. Obviously I've made a mistake somewhere but it isn't
obvious (otherwise it would be fixed already) and I'd prefer having a
profile report telling me what is taking so long rather than guessing and
possibly making things worse.
So is there any way to get a line-by-line timing profile of a user-defined
function?
Thanks!
rjsjr
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Profiling a function...
2005-01-21 16:57 Profiling a function... Robert Sanford <rsanford@trefs.com>
@ 2005-01-21 17:20 ` Richard Huxton <dev@archonet.com>
0 siblings, 0 replies; 2+ messages in thread
From: Richard Huxton @ 2005-01-21 17:20 UTC (permalink / raw)
To: Robert Sanford <rsanford@trefs.com>; +Cc: pgsql-performance
Robert Sanford wrote:
> How do I profile a user-defined function so that I know which parts of the
> function are the ones that are taking the biggest chunk of time?
>
> When I run EXPLAIN on the queries within the function none of them show up
> as onerous burdens to the performance. But when they are all operating
> together within the function and within the functional logic they become
> really expensive. Obviously I've made a mistake somewhere but it isn't
> obvious (otherwise it would be fixed already) and I'd prefer having a
> profile report telling me what is taking so long rather than guessing and
> possibly making things worse.
>
> So is there any way to get a line-by-line timing profile of a user-defined
> function?
Not really. What you can do is simulate the queries in functions by
using PREPARE. You're probably seeing a difference because when PG plans
the queries for functions/prepared queries it doesn't know the actual
values.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2005-01-21 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-21 16:57 Profiling a function... Robert Sanford <rsanford@trefs.com>
2005-01-21 17:20 ` Richard Huxton <dev@archonet.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox