Re: Parallel Seq Scan

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Parallel Seq Scan
Дата
Msg-id CA+TgmoYksKPHi1dMfa0HcUgLNRoqCMF_goGiPK1MxgJakfq5Lg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Parallel Seq Scan  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Parallel Seq Scan
Re: Parallel Seq Scan
Re: Parallel Seq Scan
Список pgsql-hackers
On Wed, Nov 11, 2015 at 12:59 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> I have a first query
>
> I looked on EXPLAIN ANALYZE output and the numbers of filtered rows are
> differen

Hmm, I see I was right about people finding more bugs once this was
committed.  That didn't take long.

There's supposed to be code to handle this - see the
SharedPlanStateInstrumentation stuff in execParallel.c - but it's
evidently a few bricks shy of a load.
ExecParallelReportInstrumentation is supposed to transfer the counts
from each worker to the DSM:
       ps_instrument = &instrumentation->ps_instrument[i];       SpinLockAcquire(&ps_instrument->mutex);
InstrAggNode(&ps_instrument->instr,planstate->instrument);       SpinLockRelease(&ps_instrument->mutex);
 

And ExecParallelRetrieveInstrumentation is supposed to slurp those
counts back into the leader's PlanState objects:
       /* No need to acquire the spinlock here; workers have exited already. */       ps_instrument =
&instrumentation->ps_instrument[i];      InstrAggNode(planstate->instrument, &ps_instrument->instr);
 

This might be a race condition, or it might be just wrong logic.
Could you test what happens if you insert something like a 1-second
sleep in ExecParallelFinish just after the call to
WaitForParallelWorkersToFinish()?  If that makes the results
consistent, this is a race.  If it doesn't, something else is wrong:
then it would be useful to know whether the workers are actually
calling ExecParallelReportInstrumentation, and whether the leader is
actually calling ExecParallelRetrieveInstrumentation, and if so
whether they are doing it for the correct set of nodes.

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



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Patch to install config/missing
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Parallel Seq Scan