Re: problem when optimizing the window aggregation

From: "Wang, Chaoyong" <Chaoyong(dot)Wang(at)emc(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: problem when optimizing the window aggregation
Date: 2012-08-22 02:52:04
Message-ID: 95FA8B25DB5E2D4E889EB9BEB6A6406F3CAE78@CORPUSMX30B.corp.emc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks again, the reason is found.

The following statement frees all the context for aggregation, including the transValue and tempTransValue:
MemoryContextResetAndDeleteChildren(winstate->aggcontext);

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: 2012年8月22日 9:47
To: Wang, Chaoyong
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] problem when optimizing the window aggregation

"Wang, Chaoyong" <Chaoyong(dot)Wang(at)emc(dot)com> writes:
> I used the function datumCopy as following:

> peraggstate->transValue = datumCopy(peraggstate->tempTransValue,
> peraggstate->transtypeByVal, peraggstate->transtypeLen);

You need to guard that with an is-null check, because datumCopy isn't
designed to cope with null values. (Which is historical, I guess, but
we're not likely to change it now.) If you look around you will find
plenty of examples of this coding pattern.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2012-08-22 03:04:05 Re: [WIP] Performance Improvement by reducing WAL for Update Operation
Previous Message Tatsuo Ishii 2012-08-22 02:02:56 Re: multi-master pgbench?