Re: unsigned types - Mailing list pgsql-general

From Neil Conway
Subject Re: unsigned types
Date
Msg-id 1129658457.8219.59.camel@localhost.localdomain
Whole thread Raw
In response to Re: unsigned types  ("Jim C. Nasby" <jnasby@pervasive.com>)
Responses Re: unsigned types  (Martijn van Oosterhout <kleptog@svana.org>)
Re: unsigned types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, 2005-17-10 at 12:25 -0500, Jim C. Nasby wrote:
> So, if you have a bunch of int2's all next to each other in a table,
> they will happily just consume 2 bytes. The issue comes when you try
> and mix them with other fields randomly, since many other fields
> require int alignment.

We could improve on this by reordering fields on-disk to reduce
alignment/padding requirements, during CREATE TABLE. We'd need to be
sure to present the same column order back to the client application, of
course, but that should be possible. The notion of a "physical column
number" (on-disk position of the column) as well as a "logical column
numer" (position of the column in the table -- e.g. in SELECT *
expansion) would also make it easy to implement column reordering in
ALTER TABLE, which has been requested a few times.

-Neil



pgsql-general by date:

Previous
From: "Onyx"
Date:
Subject: Re: About postgreSQL database Synchorization
Next
From: Martijn van Oosterhout
Date:
Subject: Re: unsigned types