Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault
Дата
Msg-id 14790.1256929430@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault  (Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>)
Список pgsql-bugs
Stefan Kaltenbrunner <stefan@kaltenbrunner.cc> writes:
> However the error seems to go away after an ANALYZE... so I wonder if
> this is just another case of "if we missestimated the size of the
> hashtable we are doomed"

Actually, what seems to be happening on a 32-bit machine is that
ExecChooseHashTableSize sets nbatch = INT_MAX/2, and then when we
try to do

        hashtable->outerBatchFile = (BufFile **)
            palloc0(nbatch * sizeof(BufFile *));

the memory size calculation overflows to zero, so we get an empty
outerBatchFile array.  So the fix is to make sure we limit the
number of batches to something sane, perhaps work_mem / sizeof(pointer).

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5145: Complex query with lots of LEFT JOIN causes segfault
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: BUG #5151: autovacuum process segfaults when max_fsm_pages are too low