Re: Why does ExecComputeStoredGenerated() form a heap tuple - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Why does ExecComputeStoredGenerated() form a heap tuple
Date
Msg-id a9e336ae-b4a6-1f8a-0841-8eb1af646df4@2ndquadrant.com
Whole thread Raw
In response to Re: Why does ExecComputeStoredGenerated() form a heap tuple  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Why does ExecComputeStoredGenerated() form a heap tuple  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
On 2019-04-24 00:26, David Rowley wrote:
> I didn't do the exact same test, but if I use COPY instead of \copy,
> then for me patched is faster.

OK, confirmed that way, too.

> For the patch, I wonder if you need this line:
> 
> + memcpy(values, slot->tts_values, sizeof(*values) * natts);
> 
> If you got rid of that and changed the datumCopy to use
> slot->tts_values[i] instead.

done

> Maybe it's also worth getting rid of the first memcpy for the null
> array and just assign the element in the else clause.

Tried that, seems to be slower.  So I left it as is.

> It might also be cleaner to assign TupleDescAttr(tupdesc, i) to a
> variable instead of using the macro 3 times. It'd make that datumCopy
> line shorter too.

Also done.

Updated patch attached.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Parallel Foreign Scans - need advice
Next
From: Korry Douglas
Date:
Subject: Re: Parallel Foreign Scans - need advice