Re: ToDo: fast update of arrays with fixed length fields for PL/pgSQL

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ToDo: fast update of arrays with fixed length fields for PL/pgSQL
Date: 2013-10-07 14:22:10
Message-ID: CAFj8pRB+RzMmy4K2_DeHecz5k6MigmD=uQmayQ4SWQNZesj2TA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/10/7 Andres Freund <andres(at)2ndquadrant(dot)com>

> On 2013-10-07 16:00:54 +0200, Pavel Stehule wrote:
> > /*
> > * We need to do subscript evaluation,
> which might require
> > @@ -4321,6 +4322,14 @@ exec_assign_value(PLpgSQL_execstate *estate,
> > oldarrayval = (ArrayType *)
> DatumGetPointer(oldarraydatum);
> >
> > /*
> > + * support fast update for array scalar
> variable is enabled only
> > + * when target is a scalar variable and
> variable holds a local
> > + * copy of some array.
> > + */
> > + inplace_update = (((PLpgSQL_datum *)
> target)->dtype == PLPGSQL_DTYPE_VAR
> > + &&
> ((PLpgSQL_var *) target)->freeval);
> > +
> > + /*
> > * Build the modified array value.
> > */
>
> Will this recognize if the local Datum is just a reference to an
> external toast Datum (i.e. varattrib_1b_e)?
>
>
this works on plpgsql local copies only (when cleaning is controlled by
plpgsql) - so it should be untoasted every time.

btw when I tested this patch I found a second plpgsql array issue -
repeated untoasting :( and we should not forget it.

> I don't know much about plpgsql's implementation, so please excuse if
> the question is stupid.
>
> Greetings,
>
> Andres Freund
>
> --
> Andres Freund http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-10-07 14:52:53 Re: SSI freezing bug
Previous Message Kevin Grittner 2013-10-07 14:16:08 Re: SSI freezing bug