Field order

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Field order

Michael Schmidt
I've searched the archives and found this question was asked in 2001 but never answered.  Does the order of fields in a table make a difference?  In Paradox (from whence I come), there was some belief that reliability was increased if memo (text) fields were placed at the end of the table.  If field order does make a difference, does the EMS PostgreSQL manager "reorder" function physically rearrange the fields?
 
Thanks for your time in considering this basic question
Reply | Threaded
Open this post in threaded view
|

Re: Field order

Bruno Wolff III
On Wed, Aug 17, 2005 at 12:09:12 -0600,
  Michael Schmidt <[hidden email]> wrote:
> I've searched the archives and found this question was asked in 2001 but never answered.  Does the order of fields in a table make a difference?  In Paradox (from whence I come), there was some belief that reliability was increased if memo (text) fields were placed at the end of the table.  If field order does make a difference, does the EMS PostgreSQL manager "reorder" function physically rearrange the fields?
>
> Thanks for your time in considering this basic question

Some space can be saved by putting the columns with the largest alignments
first.
The columns are not moved around to do the above, but are kept in the
declared order.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Reply | Threaded
Open this post in threaded view
|

Re: Field order

Jim C. Nasby
On Wed, Aug 17, 2005 at 03:24:58PM -0500, Bruno Wolff III wrote:

> On Wed, Aug 17, 2005 at 12:09:12 -0600,
>   Michael Schmidt <[hidden email]> wrote:
> > I've searched the archives and found this question was asked in 2001 but never answered.  Does the order of fields in a table make a difference?  In Paradox (from whence I come), there was some belief that reliability was increased if memo (text) fields were placed at the end of the table.  If field order does make a difference, does the EMS PostgreSQL manager "reorder" function physically rearrange the fields?
> >
> > Thanks for your time in considering this basic question
>
> Some space can be saved by putting the columns with the largest alignments
> first.
> The columns are not moved around to do the above, but are kept in the
> declared order.

Ugh, and here I'd been doing it the other way around. I assume
variable-length stuff should always go last, right?

This make sense?
Variable goes last, always
Larger alignment before smaller
NOT NULL before nullable
--
Jim C. Nasby, Sr. Engineering Consultant      [hidden email]
Pervasive Software        http://pervasive.com        512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Reply | Threaded
Open this post in threaded view
|

Re: Field order

Michael Schmidt
Thanks for the comments and help!  I'll set column order accordingly.
 
Reply | Threaded
Open this post in threaded view
|

Re: Field order

Bruno Wolff III
In reply to this post by Jim C. Nasby
On Wed, Aug 17, 2005 at 17:40:34 -0500,
  "Jim C. Nasby" <[hidden email]> wrote:
>
> Ugh, and here I'd been doing it the other way around. I assume
> variable-length stuff should always go last, right?

I think it depends on the alignment of the type. Certain text, char and varchar
should go at the end. Nullable columns also make a difference since there is
a shortcut used for rows that contain nulls.

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings