Re: Optimizer not using index on 120M row table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jim(at)nasby(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimizer not using index on 120M row table
Date: 2003-04-08 04:46:27
Message-ID: 24477.1049777187@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jim C. Nasby" <jim(at)nasby(dot)net> writes:
> ... Next question... will pgsql intelligently
> order things in an item record so that they're stored most efficiently?

No, it stores 'em in the order they're declared in. There has been some
speculation in the past about trying to be smarter, but I think that
line of thought is pretty much dead in the face of ALTER TABLE ADD/DROP
COLUMN.

> What other things should be considered for column ordering?

There is some execution-speed advantage to putting fixed-width
never-null columns first, then fixed-width nullable columns (in order of
increasing probability of being null, if you want to get really tense),
finally the variable-width columns (nullability no longer matters).
Note that CHAR(n) is considered variable-width, likewise BIT(n) and
NUMERIC(n), even though one might think they could be considered fixed
width.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2003-04-08 04:57:38 Re: Arrays ... need clarification....
Previous Message Jim C. Nasby 2003-04-08 04:35:09 Re: Optimizer not using index on 120M row table