Thread: pl/pgsql performance

pl/pgsql performance

From
Mehdi Ravanbakhsh
Date:
Hi All

I have one big Pl/Pgsql function (about 1500 line code) , i can divided it to about 5  part and call each script  from main script .  In this case i need to know  which way is faster .

and some question about pgsql :

1- is  pgsql engine open one process for each script ?
2- how i can chose max connection number for pgsql server based on cpu core and RAM capacity that have maximum Efficiency?

Thanks and Best ergards.

Re: pl/pgsql performance

From
Pavel Stehule
Date:
Hello


2014-04-25 10:48 GMT+02:00 Mehdi Ravanbakhsh <babakco@gmail.com>:
Hi All

I have one big Pl/Pgsql function (about 1500 line code) , i can divided it to about 5  part and call each script  from main script .  In this case i need to know  which way is faster .

and some question about pgsql :

1- is  pgsql engine open one process for each script ?

PostgreSQL uses one CPU per session.
 
2- how i can chose max connection number for pgsql server based on cpu core and RAM capacity that have maximum Efficiency?

usually max performance is about 10 x CPU connections. But it highly depends on load.

Regards

Pavel Stehule
 

Thanks and Best ergards.

Re: pl/pgsql performance

From
Michael Paquier
Date:
On Fri, Apr 25, 2014 at 5:53 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> 2014-04-25 10:48 GMT+02:00 Mehdi Ravanbakhsh <babakco@gmail.com>:
>> 2- how i can chose max connection number for pgsql server based on cpu
>> core and RAM capacity that have maximum Efficiency?
> usually max performance is about 10 x CPU connections. But it highly depends
> on load.
As well as transaction model counts, are you for example using long or
short transactions?
As a starting point, you could as well use something like ((core_count
* 2) + effective_spindle_count). have a look here for more details:
http://wiki.postgresql.org/wiki/Number_Of_Database_Connections#How_to_Find_the_Optimal_Database_Connection_Pool_Size
--
Michael