Re: VALUES clause memory optimization (was: Values list-of-targetlists patch...)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VALUES clause memory optimization (was: Values list-of-targetlists patch...)
Date: 2006-08-03 12:48:57
Message-ID: 2922.1154609337@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers pgsql-patches

Joe Conway <mail(at)joeconway(dot)com> writes:
> In transformExpr the comment implies that it should be safe to reapply
> to an already transformed expression. What if we free the raw_parser
> expression list/cells/nodes and replace it with the as-transformed one?

How are you going to do the "replace" bit? The entire problem is that
you don't know where are all the down-links leading to the subexpression
you are currently working on.

The reason we could safely list_free inside transformInsertRow is that
we know all its callers have just built the passed-in list and so there
are no other pointers to it. That doesn't apply in the general case of
grammar output.

I think in the long run we probably ought to fix things so that the
grammar never outputs any multiply-linked trees; that little shortcut
has been a continuing source of grief for many reasons. I can't see
doing that for 8.2 though. My advice is to get that low-hanging fruit
in transformInsertRow and leave the other ideas for 8.3.

regards, tom lane

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2006-08-03 14:58:10 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES]
Previous Message Gavin Sherry 2006-08-03 05:31:06 Re: Values list-of-targetlists patch for comments (was Re:

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-03 13:01:08 Re: pg_terminate_backend
Previous Message Tom Lane 2006-08-03 12:39:21 Re: Standby Mode

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-08-03 14:58:10 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES]
Previous Message Gavin Sherry 2006-08-03 05:31:06 Re: Values list-of-targetlists patch for comments (was Re: