Re: position in DDL of columns used in indexes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: position in DDL of columns used in indexes
Дата
Msg-id 24086.1255014534@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: position in DDL of columns used in indexes  (Matthew Wakeling <matthew@flymine.org>)
Список pgsql-performance
Matthew Wakeling <matthew@flymine.org> 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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Matthew Wakeling
Дата:
Сообщение: Re: position in DDL of columns used in indexes
Следующее
От: Joe Uhl
Дата:
Сообщение: Partitioned Tables and ORDER BY