pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Slow C Function
3+ messages / 3 participants
[nested] [flat]

* Slow C Function
@ 2006-05-09 21:57  Adam Palmblad <adam@terapeak.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Adam Palmblad @ 2006-05-09 21:57 UTC (permalink / raw)
  To: pgsql-performance

 
Hi,

We've got a C function that we use here and we find that for every
connection, the first run of the function is much slower than any
subsequent runs. ( 50ms compared to 8ms)

Besides using connection pooling, are there any options to improve
performance?

By the way, we are using pg version 8.1.3.

-Adam




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Slow C Function
@ 2006-05-09 23:09  Joshua D. Drake <jd@commandprompt.com>
  parent: Adam Palmblad <adam@terapeak.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Joshua D. Drake @ 2006-05-09 23:09 UTC (permalink / raw)
  To: Adam Palmblad <adam@terapeak.com>; +Cc: pgsql-performance

Adam Palmblad wrote:
>  
> Hi,
> 
> We've got a C function that we use here and we find that for every
> connection, the first run of the function is much slower than any
> subsequent runs. ( 50ms compared to 8ms)

That is fairly standard because the data will be cached.

> 
> Besides using connection pooling, are there any options to improve
> performance?

Not that I know of but then again I am not a C programer.



> 
> By the way, we are using pg version 8.1.3.
> 
> -Adam
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 


-- 

            === The PostgreSQL Company: Command Prompt, Inc. ===
      Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
      Providing the most comprehensive  PostgreSQL solutions since 1997
                     http://www.commandprompt.com/





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Slow C Function
@ 2006-05-10 03:52  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Adam Palmblad <adam@terapeak.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2006-05-10 03:52 UTC (permalink / raw)
  To: Adam Palmblad <adam@terapeak.com>; +Cc: pgsql-performance

"Adam Palmblad" <adam@terapeak.com> writes:
> We've got a C function that we use here and we find that for every
> connection, the first run of the function is much slower than any
> subsequent runs. ( 50ms compared to 8ms)

Perhaps that represents the time needed to load the dynamic library
into the backend?  If so, the "preload_libraries" parameter might
help you fix it.  Or consider pooling connections.  Or build a custom
executable with the function linked in permanently.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-05-10 03:52 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-09 21:57 Slow C Function Adam Palmblad <adam@terapeak.com>
2006-05-09 23:09 ` Joshua D. Drake <jd@commandprompt.com>
2006-05-10 03:52 ` Tom Lane <tgl@sss.pgh.pa.us>

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