Unix Technical Forum

Slow C Function

This is a discussion on Slow C Function within the Pgsql Performance forums, part of the PostgreSQL category; --> Hi, We've got a C function that we use here and we find that for every connection, the first ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Performance

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 08:45 AM
Adam Palmblad
 
Posts: n/a
Default Slow C Function


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


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 08:45 AM
Joshua D. Drake
 
Posts: n/a
Default Re: Slow C Function

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/



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 08:46 AM
Tom Lane
 
Posts: n/a
Default Re: Slow C Function

"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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:49 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com