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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-performance by date

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