Re: VALUES clause memory optimization

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: VALUES clause memory optimization
Date: 2006-08-04 04:27:16
Message-ID: 44D2CCA4.8040507@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers pgsql-patches

Tom Lane wrote:
> 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.

What about for the specific case of an InsertStmt? It seems that we
could at least get away with freeing the raw-expression list in that case.

In terms of freeing an entire arbitrary node, could we create a
backend/nodes/freefuncs.c file that does a recursive freeObject()
similar to the way copyObject() does in backend/nodes/copyfuncs.c?

> My advice is to get that low-hanging fruit
> in transformInsertRow and leave the other ideas for 8.3.

OK. This should be safe also, correct?

Thanks,

Joe

8<----------------------------------------
diff -c -r1.341 analyze.c
*** src/backend/parser/analyze.c 2 Aug 2006 01:59:46 -0000 1.341
--- src/backend/parser/analyze.c 2 Aug 2006 05:13:20 -0000
***************
*** 2191,2196 ****
--- 2196,2202 ----
for (i = 0; i < sublist_length; i++)
{
coltypes[i] = select_common_type(coltype_lists[i], "VALUES");
+ list_free(coltype_lists[i]);
}

newExprsLists = NIL;

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Pavel Stehule 2006-08-04 04:43:08 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES]
Previous Message Tom Lane 2006-08-04 02:50:17 Re: [PATCHES] Values list-of-targetlists patch for comments (was Re:

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Sherry 2006-08-04 04:30:37 Re: 8.2 features status
Previous Message Bruce Momjian 2006-08-04 04:10:00 Re: 8.2 features status

Browse pgsql-patches by date

  From Date Subject
Next Message Pavel Stehule 2006-08-04 04:43:08 Re: Values list-of-targetlists patch for comments (was Re: [PATCHES]
Previous Message Tom Lane 2006-08-04 02:50:17 Re: [PATCHES] Values list-of-targetlists patch for comments (was Re: