Skip site navigation (1) Skip section navigation (2)

Re: Speeding up loops in pl/pgsql function

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Speeding up loops in pl/pgsql function
Date: 2011-05-25 19:02:07
Message-ID: BANLkTinGoSk9=5CQVAyvgAK4i+8235REuA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
Hello

>
> (1) Are there any good guidelines for what operations in pl/pgsql are
> optimized for which data structures?  For example, it turns out that a great
> deal of time is being spent in the substring() function, which surprised me.
>  I thought that by switching to an array, it might be faster, but that
> wasn't the case, at least in my tests.  Having a sense of what I should and
> shouldn't be trying, and which built-in functions are particularly fast or
> slow, would be useful to know.
>

PL/pgSQL is perfect like glue for SQL. For all other isn't good

http://okbob.blogspot.com/2010/04/frequent-mistakes-in-plpgsql-design.html
http://www.pgsql.cz/index.php/PL/pgSQL_%28en%29#When_PL.2FpgSQL_is_not_applicable

>
> (2) Is there any configuration setting that would (perhaps) speed things up
> a bit?  I thought that maybe work_mem would help, but the documentation
> didn't indicate this at all, and sure enough, nothing really changed when I
> increased it.
>
>

probably not

Just PL/pgSQL is not C, and you cannot do some heavy string or array operations.

Regards

Pavel Stehule

In response to

pgsql-performance by date

Next:From: Merlin MoncureDate: 2011-05-25 20:14:42
Subject: Re: Speeding up loops in pl/pgsql function
Previous:From: Alex HunsakerDate: 2011-05-25 18:48:43
Subject: Re: Speeding up loops in pl/pgsql function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group