Re: tweaking NTUP_PER_BUCKET

Поиск
Список
Период
Сортировка
Искать
От
Robert Haas
Тема
Re: tweaking NTUP_PER_BUCKET
Дата
Msg-id
CA+TgmoZRWuAxAKzodDEjRUJyrcFVGhuE9_LAvexzx8ffWrUJwA@mail.gmail.com
Ответ на
Список
Дерево обсуждения
tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Stephen Frost <sfrost@snowman.net>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Stephen Frost <sfrost@snowman.net>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Stephen Frost <sfrost@snowman.net>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tom Lane <tgl@sss.pgh.pa.us>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Atri Sharma <atri.jiit@gmail.com>
Re: tweaking NTUP_PER_BUCKET Greg Stark <stark@mit.edu>
Re: tweaking NTUP_PER_BUCKET Stephen Frost <sfrost@snowman.net>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Robert Haas <robertmhaas@gmail.com>
Re: tweaking NTUP_PER_BUCKET "Tomas Vondra" <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Robert Haas <robertmhaas@gmail.com>
Re: tweaking NTUP_PER_BUCKET "Tomas Vondra" <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Robert Haas <robertmhaas@gmail.com>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Robert Haas <robertmhaas@gmail.com>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Simon Riggs <simon@2ndQuadrant.com>
Re: tweaking NTUP_PER_BUCKET "Tomas Vondra" <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Simon Riggs <simon@2ndQuadrant.com>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Heikki Linnakangas <hlinnakangas@vmware.com>
Re: tweaking NTUP_PER_BUCKET "Tomas Vondra" <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Simon Riggs <simon@2ndQuadrant.com>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Simon Riggs <simon@2ndQuadrant.com>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
Re: tweaking NTUP_PER_BUCKET Jeff Janes <jeff.janes@gmail.com>
Re: tweaking NTUP_PER_BUCKET Tomas Vondra <tv@fuzzy.cz>
On Tue, Jul 8, 2014 at 5:16 PM, Tomas Vondra  wrote:
> Thinking about this a bit more, do we really need to build the hash
> table on the first pass? Why not to do this:
>
> (1) batching
>     - read the tuples, stuff them into a simple list
>     - don't build the hash table yet
>
> (2) building the hash table
>     - we have all the tuples in a simple list, batching is done
>     - we know exact row count, can size the table properly
>     - build the table

We could do this, and in fact we could save quite a bit of memory if
we allocated say 1MB chunks and packed the tuples in tightly instead
of palloc-ing each one separately.  But I worry that rescanning the
data to build the hash table would slow things down too much.

> Also, maybe we could use a regular linear hash table [1], instead of
> using the current implementation with NTUP_PER_BUCKET=1. (Although,
> that'd be absolutely awful with duplicates.)

Linear probing is pretty awful unless your load factor is << 1.  You'd
probably want NTUP_PER_BUCKET=0.25, or something like that, which
would eat up a lot of memory.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата:
От: Robert Haas
Дата:
FAQ