Re: plan cache overhead on plpgsql expression

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plan cache overhead on plpgsql expression
Date: 2020-02-16 16:00:35
Message-ID: CAFj8pRBNjXDj0f4gmwp-xLTL4Th=+0mA6dgWWXFLPGXU5ZO45Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

ne 16. 2. 2020 v 15:12 odesílatel Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
napsal:

> Hi
>
> when I do some profiling of plpgsql, usually I surprised how significant
> overhead has expression execution. Any calculations are very slow.
>
> This is not typical example of plpgsql, but it shows cleanly where is a
> overhead
>
> CREATE OR REPLACE FUNCTION public.foo()
> RETURNS void
> LANGUAGE plpgsql
> IMMUTABLE
> AS $function$
> declare i bigint = 0;
> begin
> while i < 100000000
> loop
> i := i + 1;
> end loop;
> end;
> $function$
>
>
> Is interesting so overhead of plan cache about 15%
>
> The execution needs 32 sec on Postgres13 and 27sec on Postgres8.2
>

On same computer same example in Perl needs only 7 sec.

Regards

Pavel

> Regards
>
> Pavel
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-02-16 17:53:07 Re: explain HashAggregate to report bucket and memory stats
Previous Message Pavel Stehule 2020-02-16 15:22:46 Re: [Proposal] Global temporary tables