Re: logical column ordering - Mailing list pgsql-hackers

From Andres Freund
Subject Re: logical column ordering
Date
Msg-id 20150103234646.GF3064@awork2.anarazel.de
Whole thread Raw
In response to logical column ordering  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: logical column ordering
List pgsql-hackers
On 2014-12-09 14:41:46 -0300, Alvaro Herrera wrote:
> So I've been updating my very old patch to allow logical and physical
> column reordering.  Here's a WIP first cut for examination.

Do you have a updated patch that has ripened further?

> The first thing where this matters is tuple descriptor expansion in
> parse analysis; at this stage, things such as "*" (in "select *") are
> turned into a target list, which must be sorted according to attlognum.
> To achieve this I added a new routine to tupledescs,
> TupleDescGetSortedAttrs() which computes a new Attribute array and
> caches it in the TupleDesc for later uses; this array points to the
> same elements in the normal attribute list but is order by attlognum.

That sounds sane.

> Another place that needs tweaking is heapam.c, which must construct a
> physical tuple from Datum/nulls arrays (heap_form_tuple).  In some cases
> the input arrays are sorted in logical column order.

I'm not sure that changing heaptuple.c's API (you mean that, not
heapam.c, right?)  is a good level to tackle this at. I think some
function to reorder values/isnull arrays into logical order and reverse
might end up being less invasive and actually faster.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Small doc patch about pg_service.conf
Next
From: Noah Misch
Date:
Subject: Re: Small doc patch about pg_service.conf