Re: position in DDL of columns used in indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matthew Wakeling <matthew@xxxxxxxxxxx> writes:
> Postgres does not split rows across multiple pages, so this should never 
> be a concern. When a row is too big for a page, Postgres will select the 
> larger of the columns from the row and compress them. If that fails to 
> bring the row size down, then Postgres will select the larger columns and 
> remove them to a separate storage area, and leave just the references in 
> the actual row. Therefore, the order of columns should not matter.

> Moreover, whether a row is used in an index should not make any 
> difference. The index stores the values too, right? Postgres will look up 
> in the index, and then fetch the rows, in two separate operations.

Yeah.  There can be a small performance advantage to putting the more
frequently accessed columns first (so you don't have to skip over other
columns to get to them).  This has nothing directly to do with whether
they are indexed, though.

			regards, tom lane

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux