Re: Changing Column Order (Was Re: MySQL vs PostgreSQL.)

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: Alessio Bragadini <alessio(at)albourne(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing Column Order (Was Re: MySQL vs PostgreSQL.)
Date: 2002-10-16 01:18:34
Message-ID: 200210160118.g9G1IYR18653@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-jdbc

Jan Wieck wrote:
> Bruce Momjian wrote:
> >
> > Alessio Bragadini wrote:
> > > On Sat, 2002-10-12 at 11:37, Gavin Sherry wrote:
> > >
> > > > I cannot think of any reason why changing column order should be
> > > > implemented in Postgres. Seems like a waste of time/more code bloat for
> > > > something which is strictly asthetic.
> > > >
> > > > Regardless, I do have collegues/clients who ask when such a feature will
> > > > be implemented. Why is this useful?
> > >
> > > Has column ordering any effect on the physical tuple disposition? I've
> > > heard discussions about keeping fixed-size fields at the beginning of
> > > the tuple and similar.
> > >
> > > Sorry for the lame question. :-)
> >
> > Yes, column ordering matches physical column ordering in the file, and
> > yes, there is a small penalty for accessing any columns after the first
> > variable-length column (pg_type.typlen < 0). CHAR() used to be a fixed
> > length column, but with TOAST (large offline storage) it became variable
> > length too. I don't think there is much of a performance hit, though.
>
> When was char() fixed size? We had fixed size things like char, char2,
> char4 ... char16. But char() is internally bpchar() and has allways been
> variable-length.

char() was fixed size only in that you could cache the column offsets
for char() becuase it was always the same width on disk before TOAST.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2002-10-16 03:02:17 Re: [HACKERS] [GENERAL] Postgres-based system to run .org registry?
Previous Message Bruce Momjian 2002-10-15 22:19:36 Re: [HACKERS] [GENERAL] Postgres-based system to run .org registry?

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Copeland 2002-10-16 01:34:01 Re: Vacuum improvement
Previous Message Bruce Momjian 2002-10-16 01:09:05 Re: COPY syntax

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2002-10-16 01:34:40 Re: Support for javax.sql.DataSource ..
Previous Message Tom Lane 2002-10-15 21:11:14 Re: blob load errors