Re: logical column ordering

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Phil Currier <pcurrier(at)gmail(dot)com>
Subject: Re: logical column ordering
Date: 2015-01-03 23:46:46
Message-ID: 20150103234646.GF3064@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2015-01-04 00:13:30 Re: Small doc patch about pg_service.conf
Previous Message Tom Lane 2015-01-03 22:33:32 Re: Small doc patch about pg_service.conf