Re: why hash on the primary key?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: why hash on the primary key?
Дата
Msg-id 140.1227903396@sss.pgh.pa.us
обсуждение исходный текст
Ответ на why hash on the primary key?  ("Robert Haas" <robertmhaas@gmail.com>)
Ответы Re: why hash on the primary key?  ("Robert Haas" <robertmhaas@gmail.com>)
Список pgsql-general
"Robert Haas" <robertmhaas@gmail.com> writes:
> It seems very strange for the planner to decide to build an in-memory
> hash table on a column that is already indexed (the primary key, no
> less!).

What's strange about it?  A probe into an in-memory hashtable is a lot
cheaper than a probe into an index, so this type of plan makes plenty
of sense if the hashtable will fit in RAM and there are going to be a
lot of probes.  (Where "a lot" means "enough to amortize the cost of
building the hashtable", of course.)

> Experimentation shows this is actually about 25% faster.

Well, that just says your cost parameters need a bit of adjustment
if you'd like the planner to get the crossover point exactly right.

            regards, tom lane

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

Предыдущее
От: "Adam Rich"
Дата:
Сообщение: Re: why hash on the primary key?
Следующее
От: "Willy-Bas Loos"
Дата:
Сообщение: Re: [pgadmin-support] Separate Sessions?? (View data <-> Query tool)