Column order performance

Поиск
Список
Период
Сортировка
От Bill Montgomery
Тема Column order performance
Дата
Msg-id 4118D008.1070606@lulu.com
обсуждение исходный текст
Ответы Re: Column order performance
Список pgsql-performance
Does the order of columns of varying size have any effect on
SELECT/INSERT/UPDATE/and/or/DELETE performance? Take the example where
an integer primary key is listed first in the table and alternatively
listed after some large varchar or text columns? For example, is this
different performance-wise:

CREATE TABLE foo
(
    foo_id serial,
    foo_data varchar(8000),
    primary key (foo_id)
);

from this?

CREATE TABLE bar
(
    bar_data varchar(8000),
    bar_id serial,
    primary key (bar_id)
);

My suspicion is it would never make a difference since the index will be
searched when querying "WHERE [foo|bar]_id=?" (as long as the planner
decides to use the index).

What about a case where a sequential scan _must_ be performed? Could the
order of columns make a difference in the number of pages read/written
if there is a mix of small and large columns?

Thanks for your help.

Best Regards,

Bill Montgomery

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: insert waits for delete with trigger
Следующее
От: Litao Wu
Дата:
Сообщение: Re: insert waits for delete with trigger